/* ============================================
   AMS Affiliate Portal - Design System
   Premium Dark Theme with Glassmorphism
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  /* Colors */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(255, 255, 255, 0.08);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #60a5fa;

  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --gradient-secondary: linear-gradient(135deg, #06b6d4, #3b82f6);
  --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-warm: linear-gradient(135deg, #f59e0b, #f43f5e);
  --gradient-bg: linear-gradient(135deg, #0a0e1a 0%, #1a1040 50%, #0a0e1a 100%);

  --border-color: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);

  /* Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Light Theme ---- */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-glass: rgba(0, 0, 0, 0.02);
  --bg-glass-hover: rgba(0, 0, 0, 0.04);
  --bg-input: rgba(0, 0, 0, 0.04);
  --bg-input-focus: rgba(0, 0, 0, 0.06);

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #2563eb;

  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --accent-cyan: #0891b2;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;

  --border-color: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.08);
}

[data-theme="light"] .bg-pattern::before {
  background: radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 50%, rgba(124, 58, 237, 0.04) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 0%, rgba(8, 145, 178, 0.04) 0%, transparent 50%);
}

[data-theme="light"] .dashboard-header {
  background: rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .loading-overlay {
  background: rgba(240, 242, 245, 0.92);
}

[data-theme="light"] .error-message {
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.15);
  color: #be123c;
}

[data-theme="light"] .btn-logout {
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.15);
  color: #be123c;
}

[data-theme="light"] .data-table thead th {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f0f2f5;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .toast-notification {
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Animated Background ---- */
.bg-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-pattern::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 50%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 0%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite alternate;
}

@keyframes bgFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-2%, 1%) scale(1.02); }
  100% { transform: translate(1%, -1%) scale(1); }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-container {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: cardEntry 0.6s var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

@keyframes cardEntry {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.login-logo img {
  height: 72px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.3));
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.input-wrapper {
  position: relative;
}

.input-wrapper .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: color var(--transition-fast);
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-normal);
  outline: none;
}

.form-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input:focus + .input-icon,
.form-input:focus ~ .input-icon {
  color: var(--accent-blue);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  margin-top: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.4);
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto;
}

.btn-primary.loading .btn-text { display: none; }
.btn-primary.loading .spinner { display: inline-block; }

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

/* Error message */
.error-message {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
  animation: shake 0.4s ease;
}

.error-message.show {
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-container {
  position: relative;
  z-index: 1;
  display: none;
  min-height: 100vh;
}

.dashboard-container.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

.login-container.hidden {
  display: none;
}

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

/* ---- Header / Navbar ---- */
.dashboard-header {
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left img {
  height: 36px;
  width: auto;
}

.header-left h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.user-code {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-logout {
  padding: 8px 16px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.4);
}

/* ---- Dashboard Content ---- */
.dashboard-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ---- Welcome Banner ---- */
.welcome-banner {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-secondary);
}

.welcome-banner h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.welcome-banner h2 span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-banner p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 14px;
}

.stat-card .stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.stat-card .stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.stat-card .stat-icon.emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.stat-card .stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Section Cards ---- */
.section-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
  animation: sectionEntry 0.5s ease both;
}

.section-card:nth-child(1) { animation-delay: 0.1s; }
.section-card:nth-child(2) { animation-delay: 0.2s; }
.section-card:nth-child(3) { animation-delay: 0.3s; }
.section-card:nth-child(4) { animation-delay: 0.4s; }

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

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.section-header .section-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.section-header .section-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.section-header .section-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.section-header .section-icon.emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.section-header .section-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.section-header .section-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }

.section-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.section-header .badge {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.section-body {
  padding: 24px;
}

/* ---- Profile Info Grid ---- */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.profile-item {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all var(--transition-fast);
}

.profile-item:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
}

.profile-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.profile-item .value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

.profile-item .value a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.profile-item .value a:hover {
  color: var(--accent-purple);
  text-decoration: underline;
}

.profile-item .value .copy-value {
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* ---- Copy Button ---- */
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 6px 14px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 6px;
  color: var(--accent-blue);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-copy:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

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

.btn-copy .btn-copy-done {
  display: none;
}

.btn-copy.copied {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--accent-emerald);
  animation: copyPop 0.3s ease;
}

.btn-copy.copied .btn-copy-icon,
.btn-copy.copied .btn-copy-text {
  display: none;
}

.btn-copy.copied .btn-copy-done {
  display: inline;
}

@keyframes copyPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ---- Data Tables ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody td {
  padding: 12px 16px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tbody td:first-child {
  color: var(--text-primary);
  font-weight: 500;
}

.data-table .amount {
  font-weight: 600;
  color: var(--accent-emerald);
  font-variant-numeric: tabular-nums;
}

.data-table .status-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.data-table .status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ---- Loading Overlay ---- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(59, 130, 246, 0.15);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---- Footer ---- */
.dashboard-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-color);
  margin-top: 24px;
}

/* ---- Refresh Bar ---- */
.refresh-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  margin-bottom: 24px;
}

.refresh-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-blue);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-refresh:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}

.btn-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-refresh .refresh-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.btn-refresh .refresh-icon.spinning {
  animation: spin 0.8s linear infinite;
}

/* ---- Toast Notification ---- */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 24px;
  color: var(--accent-emerald);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg), 0 0 20px rgba(16, 185, 129, 0.1);
  z-index: 2000;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* ---- Theme Toggle Button ---- */
.btn-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-theme:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
  transform: rotate(20deg);
}

.login-theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .login-container {
    padding: 16px;
  }

  .login-card {
    padding: 32px 20px;
    border-radius: var(--radius-lg);
  }

  .login-logo img {
    height: 56px;
  }

  .login-header h1 {
    font-size: 1.25rem;
  }

  .login-header p {
    font-size: 0.8rem;
  }

  .form-input {
    padding: 12px 14px 12px 40px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  .dashboard-header {
    padding: 0 12px;
  }

  .header-inner {
    padding: 0;
    height: 56px;
  }

  .header-left h2 {
    display: none;
  }

  .header-left img {
    height: 28px;
  }

  .header-right {
    gap: 8px;
  }

  .user-info > div {
    display: none;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  .btn-logout {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .btn-theme {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }

  .dashboard-content {
    padding: 12px;
  }

  .welcome-banner {
    padding: 16px;
    margin-bottom: 16px;
  }

  .welcome-banner h2 {
    font-size: 1.05rem;
  }

  .welcome-banner p {
    font-size: 0.8rem;
  }

  .refresh-bar {
    padding: 10px 14px;
    margin-bottom: 16px;
  }

  .refresh-status {
    font-size: 0.7rem;
  }

  .btn-refresh {
    padding: 6px 10px;
    font-size: 0.7rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    margin-bottom: 10px;
  }

  .stat-card .stat-value {
    font-size: 1.1rem;
  }

  .stat-card .stat-label {
    font-size: 0.65rem;
  }

  .section-card {
    margin-bottom: 16px;
    border-radius: var(--radius-md);
  }

  .section-header {
    padding: 14px 16px;
    gap: 10px;
  }

  .section-header .section-icon {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }

  .section-header h3 {
    font-size: 0.85rem;
  }

  .section-header .badge {
    font-size: 0.65rem;
    padding: 3px 8px;
  }

  .section-body {
    padding: 12px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .profile-item {
    padding: 12px;
  }

  .profile-item .label {
    font-size: 0.7rem;
  }

  .profile-item .value {
    font-size: 0.85rem;
  }

  .btn-copy {
    padding: 5px 12px;
    font-size: 0.7rem;
  }

  /* Mobile-friendly table: card layout */
  .data-table {
    font-size: 0.8rem;
  }

  .data-table thead th {
    padding: 10px 12px;
    font-size: 0.65rem;
  }

  .data-table tbody td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .dashboard-footer {
    padding: 16px;
    font-size: 0.7rem;
    margin-top: 16px;
  }

  .toast-notification {
    bottom: 16px;
    right: 16px;
    left: 16px;
    text-align: center;
    font-size: 0.8rem;
    padding: 12px 16px;
  }
}

@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
  }

  .stat-card .stat-icon {
    margin-bottom: 0;
  }

  .stat-card .stat-value {
    font-size: 1.15rem;
  }
}
