/* ============================================================
   DarbGPT – Portal & Dashboard Styling (Parents & Teachers)
   ============================================================ */

:root {
  --primary-deep: #074764;
  --primary: #0a84a6;
  --primary-light: #44c6e2;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --accent-red: #ef4444;
  --bg-gradient: linear-gradient(135deg, #0b698b 0%, #064560 50%, #032b3d 100%);
  --card-bg: rgba(255, 255, 255, 0.94);
  --card-glass: rgba(255, 255, 255, 0.14);
  --card-border: rgba(255, 255, 255, 0.35);
  --text-dark: #10384f;
  --text-muted: #567688;
  --shadow-lg: 0 12px 35px rgba(0, 20, 40, 0.35);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Cairo', Tahoma, sans-serif;
  direction: rtl;
  text-align: right;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-dark);
  position: relative;
  overflow-x: hidden;
}

/* Background animated bubbles / ocean wave */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 15% 20%, rgba(255,255,255,0.08) 0, transparent 40%),
              radial-gradient(circle at 85% 75%, rgba(68,198,226,0.12) 0, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Container */
.portal-container {
  position: relative;
  z-index: 1;
  width: min(1140px, 94%);
  margin: 0 auto;
  padding: 24px 0 60px;
}

/* Header */
.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.portal-brand-logo {
  font-size: 34px;
  line-height: 1;
}

.portal-brand h1 {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary-deep);
  margin: 0;
}

.portal-brand span {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
}

.portal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge-sub {
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge-sub.trial { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.badge-sub.active { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.badge-sub.pending { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }
.badge-sub.expired { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.btn-portal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn-portal:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn-portal:active { transform: scale(0.97); }

.btn-primary { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 4px 12px rgba(16,185,129,0.35); }
.btn-secondary { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.btn-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.btn-gold { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 4px 12px rgba(245,158,11,0.35); }
.btn-logout { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

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

.stat-card {
  background: var(--card-bg);
  border: 2px solid #ffffff;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #e0f7fa, #b2ebf2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.stat-card.gold .stat-icon { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.stat-card.green .stat-icon { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }

.stat-info small {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
}
.stat-info b {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary-deep);
  display: block;
}

/* Sections */
.portal-section {
  background: var(--card-bg);
  border: 2px solid #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 2px solid #edf2f7;
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.section-head h2 {
  font-size: 19px;
  font-weight: 900;
  color: var(--primary-deep);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Children & Classes Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

.item-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  border-color: var(--primary-light);
}

.item-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.item-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

.item-title h3 {
  font-size: 17px;
  font-weight: 900;
  color: var(--primary-deep);
  margin-bottom: 3px;
}
.item-title span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
}

.item-stats-row {
  display: flex;
  justify-content: space-around;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 16px;
  text-align: center;
}
.item-stat-col small { font-size: 10px; color: var(--text-muted); font-weight: 700; display: block; }
.item-stat-col b { font-size: 15px; font-weight: 900; color: var(--primary-deep); }

.item-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.item-card-actions button,
.item-card-actions a {
  flex: 1;
  text-align: center;
  font-size: 12px;
  padding: 8px 10px;
}

/* Empty State Card */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 52px; margin-bottom: 10px; }
.empty-state h3 { font-size: 18px; color: var(--primary-deep); margin-bottom: 6px; font-weight: 800; }
.empty-state p { font-size: 13px; max-width: 420px; margin: 0 auto 18px; line-height: 1.6; }

/* Tabs Bar */
.tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #edf2f7;
  padding-bottom: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  background: #f1f5f9;
  color: var(--text-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(10,132,166,0.3);
}

/* Tables Styling */
.portal-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
}
.portal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}
.portal-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 900;
  color: var(--primary-deep);
  border-bottom: 2px solid #e2e8f0;
}
.portal-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.portal-table tr:hover {
  background: #f0f9ff;
}

/* Modals */
.portal-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(4, 30, 48, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.portal-modal {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  width: min(520px, 100%);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.portal-modal h3 {
  font-size: 20px;
  font-weight: 900;
  color: var(--primary-deep);
  margin-bottom: 6px;
}
.portal-modal p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}
.portal-modal-close {
  position: absolute;
  top: 18px;
  left: 18px;
  background: #f1f5f9;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-weight: 900;
}
.portal-modal-close:hover { background: #fee2e2; color: #ef4444; }

/* Forms */
.form-group {
  margin-bottom: 16px;
  text-align: right;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #f8fafc;
}
.form-control:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(10,132,166,0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 14px;
}
.form-alert.error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.form-alert.success { background: #d1fae5; color: #047857; border: 1px solid #6ee7b7; }

/* Package Card */
.package-card {
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 18px;
  background: #fff;
  transition: border-color 0.2s;
}
.package-card.highlight {
  border-color: var(--accent-gold);
  background: linear-gradient(145deg, #fffdf5, #fff8e6);
}
.package-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.package-title { font-size: 16px; font-weight: 900; color: var(--primary-deep); }
.package-price { font-size: 18px; font-weight: 900; color: var(--accent-gold); }
.package-desc { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive adjustments */
@media (max-width: 768px) {
  .portal-header { padding: 14px 16px; }
  .portal-brand h1 { font-size: 19px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
}
