/* ============================================================
   Insight Academic Writing - Custom Styles
   White / Dark-Blue theme + Dark Mode
   ============================================================ */

/* ---------- CSS VARIABLES ---------- */
:root {
  --brand-dark:   #0d2b5e;
  --brand-mid:    #1a3a6b;
  --brand-light:  #2563a8;
  --brand-accent: #3b82f6;
  --brand-hover:  #1e4fa3;
  --white:        #ffffff;
  --gray-50:      #f8fafc;
  --gray-100:     #f1f5f9;
  --gray-200:     #e2e8f0;
  --gray-600:     #475569;
  --gray-800:     #1e293b;
  --text-main:    #1e293b;
  --text-muted:   #64748b;
  --sidebar-w:    260px;
  --header-h:     64px;
  --radius:       10px;
  --shadow-sm:    0 1px 4px rgba(13,43,94,.10);
  --shadow-md:    0 4px 16px rgba(13,43,94,.15);
  --transition:   .2s ease;
}

[data-bs-theme="dark"] {
  --brand-dark:   #1e3a6e;
  --brand-mid:    #1a3a6b;
  --brand-accent: #60a5fa;
  --white:        #1e293b;
  --gray-50:      #0f172a;
  --gray-100:     #1e293b;
  --gray-200:     #334155;
  --text-main:    #e2e8f0;
  --text-muted:   #94a3b8;
}

/* ---------- BODY ---------- */
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--text-main);
  transition: background var(--transition), color var(--transition);
}

/* ---------- NAVBAR (PUBLIC) ---------- */
.navbar-brand {
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -.3px;
}

.navbar-dark-blue {
  background: var(--brand-dark) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.navbar-dark-blue .nav-link {
  color: rgba(255,255,255,.85) !important;
  font-weight: 500;
  transition: color var(--transition);
}

.navbar-dark-blue .nav-link:hover,
.navbar-dark-blue .nav-link.active {
  color: #fff !important;
}

/* ---------- HERO ---------- */
.hero-section {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-light) 100%);
  color: #fff;
  padding: 80px 0 60px;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-section .lead {
  font-size: 1.2rem;
  opacity: .9;
}

/* ---------- FEATURE CARDS ---------- */
.feature-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  transition: box-shadow var(--transition), transform var(--transition);
  height: 100%;
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.feature-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand-accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.6rem;
  color: #fff;
}

/* ---------- PRICING CARDS ---------- */
.pricing-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 32px 24px;
  background: var(--white);
  transition: all var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.pricing-card:hover,
.pricing-card.popular {
  border-color: var(--brand-accent);
  box-shadow: var(--shadow-md);
}

.pricing-card .price-tag {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1;
}

.pricing-card .price-tag span {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.badge-popular {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand-accent));
  color: #fff;
  font-size: .75rem;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--brand-dark);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
}

.sidebar-brand i {
  font-size: 1.4rem;
  color: var(--brand-accent);
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.sidebar-section-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.45);
  padding: 14px 24px 4px;
  font-weight: 600;
}

.sidebar-nav .nav-link {
  padding: 10px 24px;
  color: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 0;
  transition: all var(--transition);
  font-size: .92rem;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-left-color: var(--brand-accent);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.12);
  border-left-color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .82rem;
  color: rgba(255,255,255,.5);
}

/* ---------- MAIN CONTENT AREA ---------- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 500;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.top-header .page-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
}

.page-content {
  flex: 1;
  padding: 28px;
}

/* ---------- CARDS ---------- */
.card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--white);
}

.card-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  padding: 16px 20px;
}

/* ---------- STAT CARDS ---------- */
.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  border: none;
}

.stat-card::after {
  content: '';
  position: absolute;
  right: -15px;
  bottom: -15px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}

.stat-card .stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: .8rem;
  opacity: .85;
  margin-top: 4px;
}

.stat-card i {
  font-size: 1.8rem;
  opacity: .8;
}

.bg-brand-1 { background: linear-gradient(135deg, #0d2b5e, #1a3a6b); }
.bg-brand-2 { background: linear-gradient(135deg, #1a5276, #2e86c1); }
.bg-brand-3 { background: linear-gradient(135deg, #145a32, #1e8449); }
.bg-brand-4 { background: linear-gradient(135deg, #6c3483, #9b59b6); }
.bg-brand-5 { background: linear-gradient(135deg, #922b21, #e74c3c); }

/* ---------- TASK TILES ---------- */
.task-tile {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.task-tile:hover {
  border-color: var(--brand-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.task-tile.done {
  opacity: .6;
  cursor: not-allowed;
  border-color: var(--gray-200);
  background: var(--gray-50);
}

.task-tile .task-number {
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.task-tile .task-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 6px 0;
  flex: 1;
  line-height: 1.4;
}

.task-tile .task-earn {
  font-size: .8rem;
  color: #1e8449;
  font-weight: 700;
}

.task-tile.done .task-earn {
  color: var(--text-muted);
}

/* ---------- BUTTONS ---------- */
.btn-brand {
  background: var(--brand-dark);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-weight: 600;
  padding: 9px 22px;
  transition: background var(--transition);
}

.btn-brand:hover {
  background: var(--brand-hover);
  color: #fff;
}

/* ---------- FORMS ---------- */
.form-control, .form-select {
  border-radius: 7px;
  border-color: var(--gray-200);
  padding: 9px 14px;
  font-size: .92rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ---------- TABLES ---------- */
.table {
  font-size: .875rem;
}

.table th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--gray-200);
  padding: 12px 16px;
}

.table td {
  padding: 12px 16px;
  vertical-align: middle;
}

/* ---------- BADGE STYLES ---------- */
.badge {
  font-size: .73rem;
  padding: 4px 9px;
  border-radius: 5px;
  font-weight: 600;
}

/* ---------- DARK MODE TOGGLE ---------- */
#darkModeToggle {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.4);
  color: #fff;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: .82rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

#darkModeToggle:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.7);
}

/* ---------- MOBILE TOGGLE ---------- */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-main);
  cursor: pointer;
  padding: 4px;
}

/* ---------- AVATAR ---------- */
.avatar-circle {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand-accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}

/* ---------- BALANCE DISPLAY ---------- */
.balance-card {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-light) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  border: none;
}

.balance-card .balance-amount {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.balance-card .balance-label {
  font-size: .82rem;
  opacity: .8;
  margin-top: 3px;
}

/* ---------- WORD COUNT ---------- */
#wordCount {
  font-size: .82rem;
  color: var(--text-muted);
}

#wordCount.ok { color: #1e8449; }
#wordCount.bad { color: #e74c3c; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 999;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .sidebar {
    z-index: 1000;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }

  .page-content {
    padding: 16px;
  }

  .top-header {
    padding: 0 16px;
  }

  .hero-section {
    padding: 50px 0 40px;
  }
}

/* ---------- FOOTER ---------- */
footer {
  background: var(--brand-dark);
  color: rgba(255,255,255,.75);
  padding: 40px 0 20px;
}

footer h6 {
  color: #fff;
  font-weight: 600;
  margin-bottom: 12px;
}

footer a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .88rem;
  display: block;
  margin-bottom: 6px;
  transition: color var(--transition);
}

footer a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 16px;
  margin-top: 24px;
  font-size: .82rem;
  text-align: center;
  color: rgba(255,255,255,.45);
}

/* ---------- PAGINATION ---------- */
.task-search {
  max-width: 320px;
}

/* ---------- MISC ---------- */
.section-heading {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--brand-dark);
}

[data-bs-theme="dark"] .section-heading {
  color: var(--brand-accent);
}

.border-brand {
  border-color: var(--brand-accent) !important;
}

.text-brand {
  color: var(--brand-dark) !important;
}

[data-bs-theme="dark"] .text-brand {
  color: var(--brand-accent) !important;
}

.referral-link-box {
  background: var(--gray-100);
  border: 1.5px dashed var(--brand-accent);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: monospace;
  font-size: .9rem;
  word-break: break-all;
}
