@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

@font-face {
  font-family: 'Hama';
  src: url('/css/hama.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

:root {
  --primary: #ffffff;
  --primary-light: #e2e8f0;
  --primary-dark: #cbd5e1;
  --primary-glow: rgba(255, 255, 255, 0.15);
  --secondary: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --border-light: #475569;
  --glass: rgba(30, 41, 59, 0.8);
  --glass-border: rgba(255, 255, 255, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.2);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

body {
  font-family: 'Hama', 'Hama', 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(14, 165, 233, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* ===== Auth Pages ===== */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  animation: slideUp 0.6s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.auth-logo {
  text-align: center;
  margin-bottom: 36px;
}

.auth-logo .logo-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px;
  box-shadow: 0 8px 30px var(--primary-glow);
}

.auth-logo h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 6px;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Hama', 'Inter', sans-serif;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Hama', 'Hama', 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #0f172a;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 270px;
  background: rgba(10, 15, 30, 0.96);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border-left: 1px solid rgba(255,255,255,0.15);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
  box-shadow: -8px 0 40px rgba(0,0,0,0.4);
}

/* Subtle gradient line at top */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ffffff, #0ea5e9, transparent);
  border-radius: 0 0 2px 2px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  margin-bottom: 8px;
  position: relative;
}

.sidebar-header .logo-sm {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #f1f5f9, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.sidebar-header p {
  font-size: 11px;
  color: #475569;
  margin-top: 1px;
}

/* User info card inside sidebar */
.sidebar-user-card {
  margin: 0 12px 8px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #ffffff, #0ea5e9);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px; font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: #10b981; margin-top: 2px;
}
.sidebar-user-status::before {
  content: '';
  width: 6px; height: 6px;
  background: #10b981;
  border-radius: 50%;
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Page selector */
.sidebar-page-select {
  padding: 0 12px 8px;
}
.sidebar-page-select label {
  font-size: 10px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: block;
  margin-bottom: 6px;
  padding-right: 4px;
}
.sidebar-page-select select {
  width: 100%;
  padding: 9px 12px;
  background: rgba(30,41,59,0.7);
  border: 1px solid rgba(71,85,105,0.5);
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 12px;
  font-family: 'Hama', 'Inter', sans-serif;
  outline: none;
  transition: all 0.3s;
  cursor: pointer;
}
.sidebar-page-select select:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}

/* Nav section label */
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 8px 16px 4px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 11px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Hama', 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  border: 1px solid transparent;
  background: none;
  width: 100%;
  text-align: right;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #c7d2fe;
  border-color: rgba(255,255,255,0.12);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
  color: #ffffff;
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 2px 12px rgba(255,255,255,0.15);
}

.nav-item.active .nav-icon-wrap {
  background: linear-gradient(135deg, #ffffff, #e2e8f0);
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(255,255,255,0.4);
}

.nav-icon-wrap {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: rgba(51,65,85,0.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.25s;
  color: #64748b;
}

.nav-item:hover .nav-icon-wrap {
  background: rgba(255,255,255,0.15);
  color: #cbd5e1;
}

/* Keep old nav-icon for compatibility */
.nav-item .nav-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
}

/* ===== Sidebar Subscription Card ===== */
.sidebar-sub-card {
  margin: 4px 10px 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 20, 40, 0.7);
  border: 1px solid rgba(99,102,241,0.2);
  position: relative;
  overflow: hidden;
}
.sidebar-sub-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(14,165,233,0.04));
  pointer-events: none;
}
.sidebar-sub-card.expired {
  border-color: rgba(239,68,68,0.3);
  background: rgba(40,10,10,0.7);
}
.sidebar-sub-card.warning {
  border-color: rgba(245,158,11,0.3);
  background: rgba(40,30,5,0.7);
}
.sidebar-sub-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.sidebar-sub-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: white; flex-shrink: 0;
}
.sidebar-sub-card.expired .sidebar-sub-icon {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.sidebar-sub-card.warning .sidebar-sub-icon {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.sidebar-sub-plan {
  font-size: 12px;
  font-weight: 700;
  color: #c7d2fe;
  flex: 1;
}
.sidebar-sub-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(16,185,129,0.15);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.25);
  letter-spacing: 0.3px;
}
.sidebar-sub-card.expired .sidebar-sub-badge {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.25);
}
.sidebar-sub-card.warning .sidebar-sub-badge {
  background: rgba(245,158,11,0.15);
  color: #fcd34d;
  border-color: rgba(245,158,11,0.25);
}
/* Countdown blocks */
.sidebar-sub-countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}
.sidebar-sub-time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 32px;
  background: rgba(30,41,59,0.8);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
  padding: 4px 4px 3px;
}
.sidebar-sub-num {
  font-size: 14px;
  font-weight: 800;
  color: #f1f5f9;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sidebar-sub-card.expired .sidebar-sub-num { color: #fca5a5; }
.sidebar-sub-card.warning .sidebar-sub-num { color: #fcd34d; }
.sidebar-sub-unit {
  font-size: 8px;
  color: #475569;
  margin-top: 3px;
  letter-spacing: 0.3px;
}
.sidebar-sub-sep {
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 6px;
}
/* Progress bar */
.sidebar-sub-bar-wrap {
  height: 4px;
  background: rgba(51,65,85,0.6);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.sidebar-sub-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #0ea5e9);
  transition: width 1s ease;
}
.sidebar-sub-card.warning .sidebar-sub-bar {
  background: linear-gradient(90deg, #f59e0b, #fcd34d);
}
.sidebar-sub-card.expired .sidebar-sub-bar {
  background: #ef4444;
  width: 100% !important;
}
.sidebar-sub-label {
  font-size: 9px;
  color: #475569;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px 20px;
  border-top: 1px solid rgba(51,65,85,0.5);
  margin-top: 4px;
}

.nav-item.nav-logout {
  color: #64748b;
}
.nav-item.nav-logout:hover {
  background: rgba(239,68,68,0.08);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.15);
}
.nav-item.nav-logout:hover .nav-icon-wrap {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-right: 280px;
  padding: 32px;
  min-height: 100vh;
  overflow: hidden;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ===== Stats Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.stat-card .stat-icon.blue { background: rgba(255, 255, 255, 0.15); color: var(--primary-light); }
.stat-card .stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-card .stat-icon.yellow { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-card .stat-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.stat-card .stat-icon.cyan { background: rgba(14, 165, 233, 0.15); color: var(--secondary); }

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Table ===== */
.table-container {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.table-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary);
}

.search-box input {
  background: none;
  border: none;
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
  width: 200px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 14px 20px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.2);
}

td {
  padding: 16px 20px;
  font-size: 14px;
  border-top: 1px solid var(--border);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

/* ===== Badges ===== */
.badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-info {
  background: rgba(14, 165, 233, 0.15);
  color: var(--secondary);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
  margin: auto 0;
  flex-shrink: 0;
}

.modal h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

/* ===== Mobile Modal Fix ===== */
@media (max-width: 600px) {
  .modal-overlay {
    padding: 12px;
    align-items: flex-start;
  }
  .modal {
    padding: 20px 16px;
    border-radius: 16px;
    margin: 12px 0;
    max-width: 100%;
  }
  .modal h3 {
    font-size: 17px;
    margin-bottom: 16px;
  }
  .modal-actions {
    margin-top: 16px;
    gap: 8px;
  }
  .modal-actions .btn {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    font-size: 13px;
    justify-content: center;
  }
}

/* ===== Modal Setting Cards ===== */
.modal-setting-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: var(--transition);
}
.modal-setting-card:hover {
  border-color: rgba(255,255,255,0.15);
}
.modal-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-setting-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-setting-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 600px) {
  .modal-setting-card {
    padding: 12px;
    margin-bottom: 10px;
  }
  .modal-setting-title {
    font-size: 13px;
  }
  .modal-setting-desc {
    font-size: 10px;
  }
  .modal textarea {
    min-height: 70px !important;
    font-size: 13px;
  }
}

/* ===== Toggle Switch ===== */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 26px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px;
  right: 3px;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--success);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(-22px);
  background: #0f172a;
}

/* ===== Post Cards ===== */
.posts-grid {
  display: grid;
  gap: 20px;
}

.post-card {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.post-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 30px var(--primary-glow);
}

.post-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.post-card-header .page-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-card-header .page-info img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.post-card-header .page-info .page-name {
  font-weight: 600;
  font-size: 14px;
}

.post-card-header .page-info .post-date {
  font-size: 11px;
  color: var(--text-muted);
}

.post-card-body {
  padding: 16px 20px;
}

.post-card-body .post-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.post-card-body .post-image {
  width: 100%;
  border-radius: var(--radius-sm);
  max-height: 300px;
  object-fit: cover;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  gap: 12px;
}

/* ===== Page Selector ===== */
.page-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  color: var(--text-secondary);
}

.page-tab:hover, .page-tab.active {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-light);
}

.page-tab img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* ===== Announcement Banner ===== */
.announcement-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid;
  animation: slideDown 0.4s ease;
  backdrop-filter: blur(8px);
  margin-bottom: 12px;
}

.announcement-banner .ann-icon {
  font-size: 20px;
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

.announcement-banner .ann-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.announcement-banner .ann-close {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  font-size: 18px;
  color: inherit;
  padding: 0 4px;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.announcement-banner .ann-close:hover { opacity: 1; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Subscription Banner ===== */
.sub-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.sub-banner.expired {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border-color: rgba(239, 68, 68, 0.3);
}

.sub-banner .sub-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sub-banner .sub-icon {
  font-size: 24px;
}

.sub-banner .sub-text h4 {
  font-size: 14px;
  font-weight: 600;
}

.sub-banner .sub-text p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Notification / Toast ===== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  z-index: 9999;
  box-shadow: var(--shadow);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* ===== Mobile Topbar ===== */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: rgba(10, 15, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  z-index: 150;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.mobile-topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), rgba(14,165,233,0.2), transparent);
}

/* Hamburger Button */
.hamburger-btn {
  width: 40px; height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  flex-shrink: 0;
}
.hamburger-btn:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.4);
}
.hamburger-btn.active {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
}

.ham-line {
  display: block;
  width: 18px; height: 2px;
  background: #a5b4fc;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  transform-origin: center;
}
.hamburger-btn.active .ham-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.active .ham-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger-btn.active .ham-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Topbar Brand */
.mobile-topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.mobile-topbar-brand img {
  width: 28px; height: 28px;
  object-fit: contain;
  animation: spin 4s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.5));
}
.mobile-topbar-brand span {
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #f1f5f9, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

/* Topbar right dot (online indicator) */
.mobile-topbar-user { width: 40px; display: flex; justify-content: flex-end; }
.mobile-user-dot {
  width: 10px; height: 10px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid rgba(10,15,30,0.8);
  box-shadow: 0 0 8px rgba(16,185,129,0.5);
  animation: statusPulse 2s ease-in-out infinite;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 99;
  animation: fadeIn 0.25s ease;
}
.sidebar-overlay.show { display: block; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ===== Loading Spinner ===== */
.spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 40px auto;
}

.spinner img {
  width: 64px;
  height: 64px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Skeleton Loading ===== */
@keyframes shimmer {
  0% { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton-grid {
  display: grid;
  gap: 20px;
}

.skeleton-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.skeleton-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.skeleton-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.skeleton-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skeleton-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
}

.skeleton-image {
  width: 100%; height: 180px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
}
.skeleton-line-sm  { width: 30%; }
.skeleton-line-md  { width: 50%; }
.skeleton-line-lg  { width: 75%; }
.skeleton-line-full { width: 100%; }

/* Shimmer effect on all skeleton elements */
.skeleton-avatar,
.skeleton-btn,
.skeleton-image,
.skeleton-line {
  background: linear-gradient(
    90deg,
    rgba(51, 65, 85, 0.6) 25%,
    rgba(71, 85, 105, 0.9) 50%,
    rgba(51, 65, 85, 0.6) 75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}

/* ===== Modern Main Content Components ===== */

/* Section Header */
.mc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}
.mc-header::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), rgba(14,165,233,0.3), transparent);
}

.mc-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mc-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.mc-title {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #f1f5f9 30%, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.mc-subtitle {
  color: #64748b;
  font-size: 13px;
  margin-top: 3px;
}

.mc-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Hama', 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  text-decoration: none;
}

.mc-btn-primary {
  background: linear-gradient(135deg, #ffffff, #e2e8f0);
  color: #0f172a;
  box-shadow: 0 4px 16px rgba(255,255,255,0.35);
}
.mc-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255,255,255,0.45);
}

.mc-btn-outline {
  background: rgba(30,41,59,0.7);
  border: 1px solid rgba(71,85,105,0.5);
  color: #94a3b8;
}
.mc-btn-outline:hover {
  border-color: rgba(255,255,255,0.5);
  color: #a5b4fc;
  background: rgba(255,255,255,0.08);
}

/* Modern Empty State */
.mc-empty {
  text-align: center;
  padding: 70px 20px;
  position: relative;
}
.mc-empty-glow {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.12), transparent);
  pointer-events: none;
  border-radius: 50%;
}
.mc-empty-icon {
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #ffffff;
  margin: 0 auto 20px;
  position: relative;
}
.mc-empty h3 {
  font-size: 18px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 8px;
}
.mc-empty p {
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
  max-width: 320px;
  margin: 0 auto;
}

/* Subscription Grid */
.mc-sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.mc-sub-card {
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s;
  backdrop-filter: blur(12px);
}
.mc-sub-card:hover {
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.mc-sub-card-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.mc-sub-card-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.mc-sub-card-value {
  font-size: 20px;
  font-weight: 800;
  color: #f1f5f9;
  line-height: 1.2;
}

/* Detail Card */
.mc-detail-card {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.mc-detail-card-header {
  padding: 16px 24px;
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc-detail-card-header i { color: #ffffff; }

.mc-detail-rows { padding: 8px 0; }

.mc-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(51,65,85,0.4);
  transition: background 0.2s;
}
.mc-detail-row:last-child { border-bottom: none; }
.mc-detail-row:hover { background: rgba(255,255,255,0.04); }

.mc-detail-key {
  font-size: 13px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc-detail-key i { color: #475569; width: 14px; text-align: center; }

.mc-detail-val {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(100%);
    width: 280px;
    top: 60px;
    height: calc(100vh - 60px);
    z-index: 100;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-right: 0;
    padding: 80px 16px 20px;
  }
  .mobile-topbar { display: flex; }
  .page-header h1 { font-size: 22px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 32px 24px; }
  table { font-size: 12px; }
  th, td { padding: 10px 12px; }
  .mc-header { padding: 16px 18px; }
  .mc-title { font-size: 18px; }
  .mc-sub-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .mc-sub-grid { grid-template-columns: 1fr; }
  .mc-header { flex-direction: column; align-items: flex-start; }
}

/* ===== PWA Install Banner ===== */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 9999;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  direction: rtl;
}

.install-banner.show {
  transform: translateY(0);
}

.install-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.install-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.install-banner-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.install-banner-text h4 {
  color: white;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.install-banner-text p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.install-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.install-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Hama', 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
}

.install-btn-primary {
  background: white;
  color: var(--primary-dark);
}

.install-btn-primary:hover {
  background: #f1f5f9;
  transform: scale(1.03);
}

.install-btn-dismiss {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.install-btn-dismiss:hover {
  background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 480px) {
  .install-banner {
    flex-direction: column;
    padding: 14px 16px;
    gap: 12px;
  }
  .install-banner-actions {
    width: 100%;
  }
  .install-btn {
    flex: 1;
    text-align: center;
  }
}
