/* ==========================================================================
   Tools Page (เครื่องมือประจำ) - YoYo Land
   100% Match with Reference Design (Pastel / Dreamy Glassmorphism / Space Tone)
   ========================================================================== */

.tools-page-wrapper {
  padding: 30px 40px 60px;
  max-width: 1720px;
  margin: 0 auto;
  box-sizing: border-box;
  animation: fadeInTools 0.3s ease-out;
}

@keyframes fadeInTools {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.tools-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  width: 100%;
  gap: 20px;
  flex-wrap: wrap;
}

.tools-header-left {
  display: flex;
  flex-direction: column;
}

.tools-pretitle {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #6366f1;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.tools-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.tools-main-title {
  font-size: 28px;
  font-weight: 800;
  color: #1e1b4b;
  margin: 0;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.tools-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.2);
  white-space: nowrap;
}

.tools-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* Header Controls Right */
.tools-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tools-search-box {
  position: relative;
  width: 270px;
}

.tools-search-box input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  padding: 0 36px 0 38px;
  font-size: 13.5px;
  color: #1e293b;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
}

.tools-search-box input:focus {
  border-color: #6366f1;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.tools-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #94a3b8;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tools-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #64748b;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.tools-search-clear:hover {
  background: #cbd5e1;
  color: #334155;
}

.tools-btn-add {
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4338ca 0%, #3b82f6 100%);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(67, 56, 202, 0.25);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tools-btn-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(67, 56, 202, 0.35);
  filter: brightness(1.06);
}

/* Tools Grid Layout */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
}

@media (max-width: 1350px) {
  .tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .tools-page-wrapper {
    padding: 20px 16px 40px;
  }
  .tools-search-box {
    width: 100%;
  }
  .tools-header-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .tools-btn-add {
    justify-content: center;
  }
}

/* Tool Card */
.tool-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 28px rgba(110, 130, 180, 0.10), 0 2px 8px rgba(110, 130, 180, 0.05);
  padding: 20px 22px 18px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-sizing: border-box;
  min-height: 165px;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(110, 130, 180, 0.16), 0 4px 12px rgba(110, 130, 180, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
}

/* Card Top Area */
.tool-card-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
  width: 100%;
}

.tool-icon-box {
  width: 58px;
  height: 58px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.8);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(110, 130, 180, 0.08);
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

.tool-img-icon {
  width: 50px;
  height: 50px;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
  transition: transform 0.2s ease;
}

/* Individual optical scale balancing for visual parity */
.tool-img-icon--uptimerobot {
  width: 52px;
  height: 52px;
}

.tool-img-icon--devtools {
  width: 52px;
  height: 52px;
}

.tool-img-icon--github {
  width: 51px;
  height: 51px;
}

.tool-img-icon--render {
  width: 51px;
  height: 51px;
}

.tool-img-icon--twitter {
  width: 51px;
  height: 51px;
}

.tool-img-icon--gsheet {
  width: 51px;
  height: 51px;
}

.tool-img-icon--ga {
  width: 51px;
  height: 51px;
}

.tool-card:hover .tool-img-icon {
  transform: scale(1.05);
}

.tool-info-col {
  flex: 1;
  min-width: 0;
  padding-right: 42px;
}

.tool-status-badge {
  position: absolute;
  right: 0;
  top: 0;
  padding: 3px 9px;
  border-radius: 12px;
  background: #dcfbf7;
  color: #0d9488;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.tool-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 3px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.tool-note {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  margin: 0 0 5px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
  min-height: 18px;
}

.tool-short-url {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #6366f1;
  text-decoration: none;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
  line-height: 1.3;
}

.tool-short-url:hover {
  color: #4338ca;
  text-decoration: underline;
}

.tool-short-url svg {
  flex-shrink: 0;
}

/* Card Bottom Actions */
.tool-card-bottom {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding-top: 14px;
  width: 100%;
}

.tool-btn-go {
  flex: 1 1 76%;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4338ca 0%, #3b82f6 100%);
  color: #ffffff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.25);
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  box-sizing: border-box;
}

.tool-btn-go:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 16px rgba(67, 56, 202, 0.35);
  transform: translateY(-1px);
}

.tool-btn-edit {
  flex: 0 0 24%;
  min-width: 68px;
  height: 40px;
  border-radius: 12px;
  background: #fdf2f8;
  border: 1px solid rgba(244, 114, 182, 0.45);
  color: #db2777;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  text-decoration: none;
}

.tool-btn-edit:hover {
  background: #fce7f3;
  color: #be185d;
  border-color: rgba(236, 72, 153, 0.65);
  transform: translateY(-1px);
}

/* Empty search state */
.tools-empty-state {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 1px dashed rgba(148, 163, 184, 0.4);
}

.tools-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  color: #94a3b8;
}

.tools-empty-title {
  font-size: 17px;
  font-weight: 700;
  color: #334155;
  margin: 0 0 6px 0;
}

.tools-empty-desc {
  font-size: 13.5px;
  color: #64748b;
  margin: 0 0 16px 0;
}

.tools-empty-clear-btn {
  padding: 8px 18px;
  border-radius: 10px;
  background: #6366f1;
  color: #ffffff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Modal Form Styles */
.tool-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tool-modal-box {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.05);
  width: 460px;
  max-width: 92vw;
  padding: 28px 30px;
  box-sizing: border-box;
  animation: scaleUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUpModal {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.tool-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-form-group {
  margin-bottom: 16px;
}

.tool-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.tool-form-label .req {
  color: #ef4444;
  margin-left: 2px;
}

.tool-form-input {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  padding: 0 14px;
  font-size: 14px;
  color: #1e293b;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s ease;
  background: #f8fafc;
}

.tool-form-input:focus {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.tool-field-error {
  color: #e11d48;
  font-size: 12px;
  font-weight: 500;
  margin-top: 5px;
  line-height: 1.4;
}

.tool-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.tool-btn-cancel {
  height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-btn-cancel:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.tool-btn-submit {
  height: 40px;
  padding: 0 22px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4338ca 0%, #3b82f6 100%);
  color: #ffffff;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.25);
  transition: all 0.2s ease;
}

.tool-btn-submit:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 16px rgba(67, 56, 202, 0.35);
}
