/* ============================================
   AiRAB Branding Kit — Design Tokens & Styles
   Based on airab-branding-kit-ai.html
   ============================================ */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700&display=swap');

/* ── CSS Variables (Design Tokens) ── */
:root {
  /* Brand Colors */
  --primary: #1B5FAE;
  --primary-dark: #0E3A66;
  --primary-light: #3DA9FC;
  --cyan-ai: #21C7D9;
  --slate: #64748B;
  --surface: #F8FAFC;
  --surface-blue: #EEF7FF;
  --border: #DCE5EF;
  --body-text: #334155;
  --white: #FFFFFF;

  /* Status */
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;

  /* Spacing & Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Typography */
  --font-display: 'Poppins', sans-serif;
  --font-body: 'Arial', 'Helvetica', sans-serif;
}

/* ── Base ── */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  color: var(--body-text);
  background: var(--surface);
  margin: 0;
  padding: 0;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6,
.display-font {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-dark);
}

/* ── Navbar ── */
.navbar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--white) !important;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
}

.navbar-brand small {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.8;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--primary-dark);
  min-height: 100vh;
  padding-top: 1rem;
}

.sidebar .list-group-item {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: none;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.sidebar .list-group-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.sidebar .list-group-item.active {
  background: var(--primary);
  color: var(--white);
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.sidebar .list-group-item i {
  margin-right: 0.5rem;
  width: 20px;
  text-align: center;
}

/* ── Primary Button ── */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  border-radius: var(--radius-md);
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #1550a0;
  border-color: #1550a0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(27, 95, 174, 0.3);
}

/* ── AI Accent Button ── */
.btn-ai {
  background: var(--cyan-ai);
  border-color: var(--cyan-ai);
  color: var(--white);
  border-radius: var(--radius-md);
  font-weight: 600;
}

.btn-ai:hover {
  background: #1ab5c5;
  border-color: #1ab5c5;
  color: var(--white);
}

/* ── Cards ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(14, 58, 102, 0.06);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(14, 58, 102, 0.1);
}

.card-header {
  background: var(--surface-blue);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 1rem 1.25rem;
}

.card-header h5,
.card-header h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

/* ── Tables ── */
.table {
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  color: var(--primary-dark);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.75rem 1rem;
}

.table tbody td {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background: var(--surface-blue);
}

/* ── Form Controls ── */
.form-control,
.form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(61, 169, 252, 0.15);
}

/* ── AI Badge ── */
.badge-ai {
  background: var(--cyan-ai);
  color: var(--white);
  font-weight: 600;
  padding: 0.35em 0.65em;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

/* ── Status Badges ── */
.badge-success {
  background: var(--success);
  color: var(--white);
}

.badge-warning {
  background: var(--warning);
  color: var(--body-text);
}

.badge-danger {
  background: var(--danger);
  color: var(--white);
}

/* ── Login Page ── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.login-card {
  background: var(--white);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(14, 58, 102, 0.2);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.login-card .logo-area {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .logo-area .brand-icon {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.login-card .logo-area .brand-icon i {
  font-size: 2rem;
  color: var(--white);
}

.login-card .logo-area h2 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
  font-size: 1.8rem;
}

.login-card .logo-area small {
  color: var(--slate);
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ── Metric Cards ── */
.metric-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: all 0.2s ease;
}

.metric-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(14, 58, 102, 0.1);
}

.metric-card .metric-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--primary);
}

.metric-card .metric-label {
  color: var(--slate);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ── AI Feature Highlight ── */
.ai-highlight {
  border-left: 3px solid var(--cyan-ai);
  background: linear-gradient(90deg, rgba(33, 199, 217, 0.05) 0%, transparent 100%);
  padding: 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.ai-highlight::before {
  content: '✨ AI';
  display: inline-block;
  background: var(--cyan-ai);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2em 0.5em;
  border-radius: var(--radius-sm);
  margin-right: 0.5rem;
  letter-spacing: 1px;
}

/* ── Step Indicator ── */
.step-indicator {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--slate);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(27, 95, 174, 0.3);
}

.step-dot.completed {
  background: var(--success);
  color: var(--white);
}

/* ── Upload Area ── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.upload-area:hover {
  border-color: var(--primary-light);
  background: var(--surface-blue);
}

.upload-area.dragover {
  border-color: var(--primary);
  background: var(--surface-blue);
}

/* ── Toast Notifications ── */
.toast {
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(14, 58, 102, 0.15);
}

.toast-header {
  background: var(--primary-dark);
  color: var(--white);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--slate);
}

/* ── Loading Spinner ── */
.spinner-ai {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan-ai);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    min-height: auto;
    padding: 0.5rem;
  }

  .sidebar .list-group-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .card {
    border-radius: var(--radius-md);
  }
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* ── Utility ── */
.text-primary-dark { color: var(--primary-dark) !important; }
.text-primary { color: var(--primary) !important; }
.text-cyan-ai { color: var(--cyan-ai) !important; }
.text-slate { color: var(--slate) !important; }
.bg-primary-dark { background-color: var(--primary-dark) !important; }
.bg-primary { background-color: var(--primary) !important; }
.bg-surface { background-color: var(--surface) !important; }
.bg-surface-blue { background-color: var(--surface-blue) !important; }
.border-brand { border-color: var(--border) !important; }

/* ── AI Accent Elements ── */

/* AI Button */
.btn-ai {
  background: linear-gradient(135deg, #21C7D9 0%, #1AB5C5 100%);
  border: none;
  color: #FFFFFF;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(33, 199, 217, 0.3);
}

.btn-ai:hover {
  background: linear-gradient(135deg, #1AB5C5 0%, #15A3B3 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(33, 199, 217, 0.4);
  color: #FFFFFF;
}

/* AI Badge */
.badge-ai {
  background: linear-gradient(135deg, #21C7D9 0%, #3DA9FC 100%);
  color: #FFFFFF;
  font-weight: 600;
  padding: 0.35em 0.65em;
  border-radius: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.badge-ai::before {
  content: '✨';
  font-size: 0.8em;
}

/* AI Highlight Section */
.ai-highlight {
  border-left: 3px solid #21C7D9;
  background: linear-gradient(90deg, rgba(33, 199, 217, 0.08) 0%, transparent 100%);
  padding: 1rem 1.25rem;
  border-radius: 0 12px 12px 0;
  margin: 1rem 0;
}

.ai-highlight-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: #0E3A66;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-highlight-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #21C7D9;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(33, 199, 217, 0.5);
}

/* AI Confidence Bar */
.confidence-bar {
  height: 6px;
  background: #DCE5EF;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.confidence-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.confidence-high { background: linear-gradient(90deg, #16A34A, #22C55E); }
.confidence-medium { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.confidence-low { background: linear-gradient(90deg, #DC2626, #EF4444); }

/* AI Pulse Animation */
@keyframes ai-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.ai-pulse {
  animation: ai-pulse 2s ease-in-out infinite;
}

/* AI Shimmer Loading */
@keyframes ai-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.ai-shimmer {
  background: linear-gradient(90deg, #F8FAFC 25%, #EEF7FF 50%, #F8FAFC 75%);
  background-size: 200% 100%;
  animation: ai-shimmer 1.5s ease-in-out infinite;
}

/* AI Status Indicator */
.ai-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.8rem;
  font-weight: 500;
}

.ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.ai-status-active { color: #21C7D9; }
.ai-status-active .ai-status-dot { background: #21C7D9; box-shadow: 0 0 6px rgba(33, 199, 217, 0.5); }
.ai-status-success { color: #16A34A; }
.ai-status-success .ai-status-dot { background: #16A34A; }
.ai-status-error { color: #DC2626; }
.ai-status-error .ai-status-dot { background: #DC2626; }

/* AI Tooltip */
.ai-tooltip {
  position: relative;
}

.ai-tooltip::after {
  content: attr(data-ai-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #0E3A66;
  color: #FFFFFF;
  padding: 0.4em 0.8em;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
}

.ai-tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  bottom: calc(100% + 8px);
}

/* ── Empty States ── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #64748B;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: #EEF7FF;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.empty-state-icon i {
    font-size: 2.5rem;
    color: #1B5FAE;
}

.empty-state h5 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #0E3A66;
    margin-bottom: 0.75rem;
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Error States ── */
.error-state {
    text-align: center;
    padding: 2rem;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 12px;
    color: #991B1B;
}

.error-state-icon {
    width: 60px;
    height: 60px;
    background: #FEE2E2;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.error-state-icon i {
    font-size: 1.8rem;
    color: #DC2626;
}

.error-state h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ── Loading States ── */
.loading-state {
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #DCE5EF;
    border-top-color: #21C7D9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

.loading-text {
    color: #64748B;
    font-size: 0.9rem;
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    background: #FFFFFF;
    border: 1px solid #DCE5EF;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(14, 58, 102, 0.15);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

.toast-success { border-left: 4px solid #16A34A; }
.toast-error { border-left: 4px solid #DC2626; }
.toast-warning { border-left: 4px solid #F59E0B; }
.toast-info { border-left: 4px solid #1B5FAE; }

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-success .toast-icon { background: #DCFCE7; color: #16A34A; }
.toast-error .toast-icon { background: #FEE2E2; color: #DC2626; }
.toast-warning .toast-icon { background: #FEF3C7; color: #F59E0B; }
.toast-info .toast-icon { background: #DBEAFE; color: #1B5FAE; }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #0E3A66;
    margin-bottom: 0.25rem;
}

.toast-message {
    color: #64748B;
    font-size: 0.85rem;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #64748B;
    cursor: pointer;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Mobile Responsive ── */

@media (max-width: 992px) {
    /* Sidebar becomes horizontal on tablet */
    .sidebar {
        min-height: auto;
        padding: 0.5rem;
        display: flex;
        overflow-x: auto;
        gap: 0.25rem;
    }
    
    .sidebar .list-group-item {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Metrics stack on tablet */
    .metric-card {
        padding: 1rem;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* Mobile layout */
    body {
        font-size: 14px;
    }
    
    /* Navbar */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-brand small {
        display: none;
    }
    
    /* Main content */
    .container-fluid {
        padding: 0.5rem;
    }
    
    /* Sidebar full width */
    .col-md-2 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .sidebar {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar::-webkit-scrollbar {
        display: none;
    }
    
    .sidebar .list-group-item {
        flex: 0 0 auto;
    }
    
    /* Content full width */
    .col-md-10 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Metric cards 2 columns */
    #dashboardMetrics .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .metric-card {
        padding: 0.75rem;
    }
    
    .metric-value {
        font-size: 1.3rem;
    }
    
    .metric-label {
        font-size: 0.75rem;
    }
    
    /* Cards */
    .card {
        border-radius: 12px;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        border-radius: 12px 12px 0 0 !important;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Tables */
    .table {
        font-size: 0.85rem;
    }
    
    .table thead th {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .table tbody td {
        padding: 0.5rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Forms */
    .form-control,
    .form-select {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .form-label {
        font-size: 0.8rem;
    }
    
    /* Step wizard */
    .step-indicator {
        justify-content: center;
        gap: 0.75rem;
    }
    
    .step-dot {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    /* Login page */
    .login-card {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }
    
    .logo-icon {
        width: 56px;
        height: 56px;
    }
    
    .logo-icon i {
        font-size: 1.8rem;
    }
    
    .brand-name {
        font-size: 1.5rem;
    }
    
    /* Toast */
    .toast {
        max-width: calc(100vw - 2rem);
        margin: 0 0.5rem;
    }
    
    /* Table responsive */
    .table-responsive {
        font-size: 0.8rem;
    }
    
    /* Hide less important columns on mobile */
    .hide-mobile {
        display: none;
    }
}

@media (max-width: 480px) {
    /* Small phones */
    #dashboardMetrics .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .metric-card {
        padding: 0.5rem;
    }
    
    .metric-value {
        font-size: 1.1rem;
    }
    
    /* Stack form fields */
    .row .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ── Touch-friendly improvements ── */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
    }
    
    .sidebar .list-group-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
    }
    
    /* Remove hover effects on touch */
    .card:hover {
        box-shadow: 0 1px 3px rgba(14, 58, 102, 0.06);
    }
    
    .metric-card:hover {
        transform: none;
        box-shadow: none;
    }
}
