/* ==========================================================================
   TRADEMARK MADRID AI PLATFORM - MODERN DARK GLASSMORPHIC STYLESHEET
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-main: #070b14;
  --bg-sidebar: #0a0f1d;
  --bg-card: #0e1629;
  --bg-card-hover: #141f38;
  --bg-modal: #0c1324;
  --border-color: #1a2642;
  --border-highlight: #283a66;
  
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
  --success: #34d399;
  --success-glow: rgba(52, 211, 153, 0.25);
  --warning: #fbbf24;
  --warning-glow: rgba(251, 191, 36, 0.25);
  --danger: #f43f5e;
  --danger-glow: rgba(244, 63, 94, 0.25);
  --purple: #a855f7;
  --purple-glow: rgba(168, 85, 247, 0.25);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  letter-spacing: -0.01em;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* ==========================================================================
   LAYOUT: SIDEBAR & MAIN CONTAINER
   ========================================================================== */

#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s;
  z-index: 40;
  position: sticky;
  top: 0;
}

#sidebar.collapsed {
  width: 76px;
  min-width: 76px;
}

#sidebar .logo-text,
#sidebar .nav-label,
#sidebar .badge-text {
  transition: opacity 0.2s ease, display 0.2s ease;
  white-space: nowrap;
}

#sidebar.collapsed .logo-text,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .badge-text {
  display: none;
  opacity: 0;
}

#sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  margin: 3px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-item.active svg {
  color: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

#main-content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TOPBAR
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 1000;
  overflow: visible;
}

.btn-wipo {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-wipo:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-wipo:active {
  transform: translateY(0);
}

.btn-wipo.running {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  cursor: not-allowed;
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* ==========================================================================
   OVERVIEW METRIC CARDS
   ========================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.metric-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.metric-card.card-blue::before { background: #38bdf8; box-shadow: 0 0 12px #38bdf8; }
.metric-card.card-green::before { background: #34d399; box-shadow: 0 0 12px #34d399; }
.metric-card.card-emerald::before { background: #10b981; box-shadow: 0 0 12px #10b981; }
.metric-card.card-amber::before { background: #fbbf24; box-shadow: 0 0 12px #fbbf24; }
.metric-card.card-red::before { background: #f43f5e; box-shadow: 0 0 12px #f43f5e; }
.metric-card.card-cyan::before { background: #06b6d4; box-shadow: 0 0 12px #06b6d4; }
.metric-card.card-purple::before { background: #a855f7; box-shadow: 0 0 12px #a855f7; }
.metric-card.card-indigo::before { background: #6366f1; box-shadow: 0 0 12px #6366f1; }
.metric-card.card-slate::before { background: #94a3b8; box-shadow: 0 0 12px #94a3b8; }

.metric-card .title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-card .value {
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
  font-feature-settings: 'tnum' on, 'lnum' on;
}

.metric-card .hint {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   RESIZABLE DATA GRID & TABLES
   ========================================================================== */

.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  position: relative;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.grid-table thead th {
  background: #0b1120;
  color: #94a3b8;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  user-select: none;
  white-space: nowrap;
}

/* Draggable Vertical Divider Resizer */
.grid-table thead th .resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  cursor: col-resize;
  user-select: none;
  height: 100%;
  z-index: 10;
}

.grid-table thead th .resizer:hover,
.grid-table thead th .resizer.resizing {
  background: var(--primary);
}

.grid-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

.grid-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.grid-table td {
  padding: 12px 14px;
  color: #cbd5e1;
  vertical-align: middle;
  border-right: 1px solid rgba(255, 255, 255, 0.03);
}

.grid-table td:last-child {
  border-right: none;
}

/* ==========================================================================
   BADGES & STATUS PILLS
   ========================================================================== */

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-ready { background: rgba(52, 211, 153, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.badge-review { background: rgba(251, 191, 36, 0.15); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.badge-failed { background: rgba(244, 63, 94, 0.15); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-dead { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-sent { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-replied { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }

/* ==========================================================================
   MODAL & DRAWER STYLES
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
}

.modal-card {
  background: var(--bg-modal);
  border: 1px solid var(--border-highlight);
  border-radius: 18px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  position: relative;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}

.btn-secondary {
  background: #0f172a;
  color: #94a3b8;
  padding: 8px 16px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
  transform: translateY(-1px);
}

.btn-secondary.active,
.btn-secondary:active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(99, 102, 241, 0.14));
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */

.input-field {
  width: 100%;
  background: #080d1a;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 9px 14px;
  color: #f8fafc;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   USER PROFILE DROPDOWN MENU
   ========================================================================== */

.profile-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.profile-trigger-btn {
  background: #0c1324 !important;
  border: 1px solid #1e293b !important;
  border-radius: 30px !important;
  padding: 5px 14px 5px 6px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  color: #f8fafc !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  outline: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.profile-trigger-btn:hover {
  background: #0e1a34 !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3) !important;
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  color: #0f172a;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.4);
}

.user-name-label {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron-icon {
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.profile-trigger-btn.active .chevron-icon {
  transform: rotate(180deg);
  color: #38bdf8;
}

.user-profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 230px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(16px);
  z-index: 1000;
  animation: fadeInDropdown 0.15s ease-out forwards;
}

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

.profile-dropdown-header {
  padding: 10px 12px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 6px;
}

.profile-dropdown-header .user-full-name {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
}

.profile-dropdown-header .user-email-text {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
  word-break: break-all;
}

.dropdown-logout-btn {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f87171;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.dropdown-logout-btn:hover {
  background: rgba(248, 113, 113, 0.14);
  color: #ef4444;
}
