/* assets/css/style.css – E-Library System
   Aesthetic: Refined navy/gold editorial, DM Sans + Playfair Display
*/

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

:root {
  --navy:     #0f2744;
  --navy-mid: #1a3c5e;
  --navy-lt:  #254d7a;
  --gold:     #c8922a;
  --gold-lt:  #e8b44a;
  --cream:    #f8f5ef;
  --white:    #ffffff;
  --text:     #1e2a3a;
  --text-sub: #5a6a7e;
  --border:   #dde3eb;
  --shadow:   0 4px 24px rgba(15,39,68,.10);
  --shadow-lg:0 12px 48px rgba(15,39,68,.16);
  --radius:   10px;
  --sidebar-w:240px;
}

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-lt); text-decoration: none; }
a:hover { color: var(--gold); }

/* ─── Typography ───────────────────────────────────────────── */
h1,h2,h3,h4 { font-family: 'Playfair Display', Georgia, serif; line-height: 1.2; }

/* ─── Utility ──────────────────────────────────────────────── */
.text-muted { color: var(--text-sub); font-size: .9rem; }
.form-control {
  width: 100%; padding: .55rem .85rem;
  border: 1.5px solid var(--border); border-radius: 7px;
  font-family: inherit; font-size: .92rem; color: var(--text);
  background: #fff; transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--navy-lt); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .3rem; color: var(--text-sub); }
.form-actions { display: flex; gap: .6rem; margin-top: 1.2rem; }
.checkbox-label { display: flex; align-items: center; gap: .4rem; cursor: pointer; font-size: .92rem; }

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.3rem; border-radius: 7px; font-family: inherit;
  font-size: .9rem; font-weight: 500; border: none; cursor: pointer;
  transition: all .18s; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-lt); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }
.btn-pay {
  background: linear-gradient(135deg, var(--navy), var(--navy-lt));
  color: #fff; font-size: 1.05rem; padding: .85rem 2rem; border-radius: 9px;
  box-shadow: 0 4px 18px rgba(15,39,68,.3);
}
.btn-pay:hover { box-shadow: 0 6px 24px rgba(15,39,68,.4); transform: translateY(-1px); color: #fff; }
.btn-sm  { padding: .4rem .9rem; font-size: .82rem; }
.btn-xs  { padding: .25rem .6rem; font-size: .78rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Alerts ───────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: 7px; font-size: .9rem; margin-bottom: 1rem; }
.alert-success { background: #eafaf1; color: #1e7e4e; border-left: 4px solid #27ae60; }
.alert-danger  { background: #fdf3f2; color: #9b2a1e; border-left: 4px solid #e74c3c; }
.alert-warning { background: #fef9ec; color: #7d5a00; border-left: 4px solid #f0a500; }

/* ─── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .6rem; border-radius: 20px; font-size: .78rem; font-weight: 500;
}
.badge-success { background: #eafaf1; color: #1e7e4e; }
.badge-danger  { background: #fdf3f2; color: #c0392b; }
.badge-warning { background: #fef9ec; color: #7d5a00; }
.badge-blue    { background: #eaf1fb; color: #1a4a8a; }
.badge-purple  { background: #f5eefb; color: #6b3fa0; }

/* ─── Auth Pages ───────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; }
.auth-split { display: flex; width: 100%; min-height: 100vh; }

.auth-hero {
  flex: 1; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-lt) 60%, #2c6396 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; position: relative; overflow: hidden;
}
.auth-hero::before {
  content: ''; position: absolute; top: -40%; right: -20%;
  width: 600px; height: 600px; border-radius: 50%;
  background: rgba(200,146,42,.08); pointer-events: none;
}
.admin-hero { background: linear-gradient(160deg, #0a1628 0%, #1a2d4a 100%); }

.hero-inner { position: relative; z-index: 1; max-width: 440px; }
.logo-mark {
  width: 64px; height: 64px; border-radius: 16px;
  background: rgba(200,146,42,.25); border: 1.5px solid rgba(200,146,42,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--gold-lt); margin-bottom: 1.5rem;
}
.hero-inner h1 { font-size: 2.4rem; color: #fff; margin-bottom: .8rem; }
.hero-inner p  { color: rgba(255,255,255,.75); font-size: 1.05rem; margin-bottom: 1.6rem; }
.hero-features { list-style: none; }
.hero-features li { color: rgba(255,255,255,.8); margin-bottom: .5rem; font-size: .95rem; }
.hero-features li i { color: var(--gold-lt); margin-right: .5rem; }

.price-badge { display: inline-flex; align-items: baseline; gap: .3rem; margin-top: 1.2rem; }
.price-amount { font-family: 'Playfair Display', serif; font-size: 3rem; color: var(--gold-lt); }
.price-period { color: rgba(255,255,255,.65); font-size: 1.1rem; }

.auth-form-panel {
  flex: 0 0 440px; display: flex; align-items: center; justify-content: center;
  padding: 2rem; background: var(--cream);
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 1.8rem; margin-bottom: .3rem; color: var(--navy); }
.auth-sub { color: var(--text-sub); margin-bottom: 1.5rem; font-size: .92rem; }
.auth-link { margin-top: 1.2rem; text-align: center; font-size: .88rem; color: var(--text-sub); }

.input-icon { position: relative; }
.input-icon i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--text-sub); font-size: .85rem; }
.input-icon input { padding-left: 2.4rem; }

/* ─── Payment Page ─────────────────────────────────────────── */
.pay-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--cream); }
.pay-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 2.5rem; width: 100%; max-width: 440px; }
.pay-header { text-align: center; margin-bottom: 2rem; }
.pay-logo-icon { font-size: 2.5rem; color: var(--navy); }
.pay-header h2 { font-size: 1.6rem; color: var(--navy); margin: .5rem 0 .2rem; }
.pay-header p  { color: var(--text-sub); font-size: .9rem; }
.pay-summary { background: var(--cream); border-radius: 10px; padding: 1.2rem 1.5rem; margin-bottom: 1.8rem; }
.pay-row { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.pay-row:last-child { border: none; }
.pay-total { font-size: 1.1rem; margin-top: .3rem; }
.pay-total strong { color: var(--gold); font-size: 1.3rem; }
.pay-secure { text-align: center; font-size: .8rem; color: #aaa; margin-top: .8rem; }

/* ─── App Layout (sidebar + main) ─────────────────────────── */
.app-page { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--navy); color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; z-index: 100;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.4rem 1.2rem 1rem;
  font-family: 'Playfair Display', serif; font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand i { color: var(--gold-lt); font-size: 1.2rem; }

.sidebar-nav { list-style: none; padding: .6rem 0; flex: 1; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem 1.2rem; font-size: .88rem;
  color: rgba(255,255,255,.72); transition: all .16s;
  border-radius: 0;
}
.sidebar-nav li a:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar-nav li.active a { color: #fff; background: rgba(200,146,42,.18); border-left: 3px solid var(--gold); padding-left: calc(1.2rem - 3px); }
.sidebar-nav li a i { width: 16px; text-align: center; font-size: .85rem; }
.sidebar-divider { padding: .6rem 1.2rem .2rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.35); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.8rem; background: #fff; border-bottom: 1.5px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.app-header h2 { font-size: 1.35rem; color: var(--navy); }

.section { padding: 1.4rem 1.8rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-head h3 { font-size: 1.1rem; color: var(--navy); }

/* ─── Stats ────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding: 1.4rem 1.8rem 0; }
.stats-row-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: #fff; border-radius: var(--radius); padding: 1.2rem 1.4rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 2px 12px rgba(15,39,68,.06); border: 1.5px solid var(--border);
}
.stat-card > i { font-size: 1.6rem; color: var(--navy-lt); }
.stat-card.stat-green > i { color: #27ae60; }
.stat-card.stat-gold  > i { color: var(--gold); }
.stat-card.stat-purple> i { color: #8e44ad; }
.stat-card.stat-red   > i { color: #e74c3c; }
.stat-card.stat-blue  > i { color: #2980b9; }
.stat-card div { display: flex; flex-direction: column; }
.stat-card strong { font-size: 1.3rem; color: var(--navy); font-family: 'Playfair Display', serif; }
.stat-card span   { font-size: .78rem; color: var(--text-sub); }

/* ─── Category Grid ────────────────────────────────────────── */
.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; padding: 1.4rem 1.8rem;
}
.cat-grid-large { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.cat-card {
  background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.2rem; text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: .5rem; transition: all .2s; cursor: pointer;
  text-decoration: none; color: inherit;
}
.cat-card:hover { border-color: var(--navy-lt); box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.cat-icon { font-size: 1.8rem; color: var(--navy-lt); margin-bottom: .3rem; }
.cat-card strong { font-size: .97rem; color: var(--navy); }
.cat-card small { font-size: .78rem; color: var(--text-sub); }

/* ─── Software Grid ────────────────────────────────────────── */
.software-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.2rem; padding: 1.4rem 1.8rem;
}
.sw-card { background: #fff; border-radius: var(--radius); border: 1.5px solid var(--border); overflow: hidden; transition: box-shadow .2s; }
.sw-card:hover { box-shadow: var(--shadow); }
.sw-thumb { height: 140px; overflow: hidden; }
.sw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sw-thumb-placeholder {
  height: 140px; background: var(--cream);
  display: flex; align-items: center; justify-content: center; color: var(--border);
}
.sw-body { padding: 1rem; }
.sw-body h4 { font-size: 1rem; color: var(--navy); margin-bottom: .3rem; }
.sw-body p  { font-size: .84rem; color: var(--text-sub); margin-bottom: .8rem; }

/* ─── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); border: 1.5px solid var(--border); margin: 0 1.8rem 1.8rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { background: var(--cream); color: var(--text-sub); font-weight: 600; padding: .75rem 1rem; text-align: left; border-bottom: 1.5px solid var(--border); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.data-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(15,39,68,.02); }
.actions { display: flex; gap: .4rem; }

/* ─── Modals ───────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(15,39,68,.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem;
}
.modal-box { background: #fff; border-radius: 14px; width: 100%; max-width: 500px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-lg { max-width: 680px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 1.5rem; border-bottom: 1.5px solid var(--border); }
.modal-head h3 { font-size: 1.1rem; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-sub); line-height: 1; }
.modal-box form, .modal-box > div { padding: 1.5rem; }
.modal-head + form { padding-top: 1.2rem; }

/* ─── Icon Picker ──────────────────────────────────────────── */
.icon-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.icon-opt { cursor: pointer; }
.icon-opt input { display: none; }
.icon-opt i {
  display: flex; width: 38px; height: 38px; align-items: center; justify-content: center;
  border-radius: 7px; border: 1.5px solid var(--border); font-size: 1rem; color: var(--text-sub);
  transition: all .15s;
}
.icon-opt.selected i, .icon-opt input:checked + i {
  border-color: var(--navy); background: var(--navy); color: #fff;
}
.icon-opt:hover i { border-color: var(--navy-lt); color: var(--navy-lt); }

/* ─── Misc ─────────────────────────────────────────────────── */
.locked-overlay-msg {
  text-align: center; padding: 3rem; color: var(--text-sub);
  background: #fff; border-radius: var(--radius); border: 1.5px dashed var(--border); margin: 0 1.8rem;
}
.locked-overlay-msg i { color: var(--border); margin-bottom: 1rem; display: block; }
.empty-state { text-align: center; padding: 4rem; color: var(--text-sub); }
.empty-state i { display: block; margin-bottom: 1rem; color: var(--border); }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  /* ── Auth layout: stack vertically ── */
  .auth-split { flex-direction: column; min-height: 100vh; }

  /* ── Hero: compact banner instead of hidden ── */
  .auth-hero {
    display: flex;
    flex: none;
    min-height: unset;
    padding: 1.6rem 1.4rem 1.5rem;
    align-items: flex-start;
  }
  .auth-hero::before { display: none; }

  .hero-inner { max-width: 100%; width: 100%; }

  .logo-mark {
    width: 44px; height: 44px; border-radius: 12px;
    font-size: 1.1rem; margin-bottom: 1rem;
  }

  .hero-inner h1 {
    font-size: 1.45rem;
    margin-bottom: .5rem;
  }

  .hero-inner > p {
    font-size: .84rem;
    margin-bottom: 1rem;
    color: rgba(255,255,255,.78);
  }

  .hero-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .35rem .75rem;
  }
  .hero-features li { font-size: .78rem; }

  /* price badge (register page) */
  .price-badge { margin-top: .9rem; }
  .price-amount { font-size: 2rem; }
  .price-period { font-size: .95rem; }

  /* ── Form panel ── */
  .auth-form-panel { flex: 1; padding: 1.6rem 1.2rem; }
  .auth-card { max-width: 100%; }

  /* ── General mobile fixes ── */
  .form-row { grid-template-columns: 1fr; }
  .stats-row, .stats-row-4 { grid-template-columns: 1fr 1fr; }
  .sidebar { position: fixed; left: -100%; width: var(--sidebar-w); transition: left .3s; }
  .sidebar.open { left: 0; }
  .app-main { margin-left: 0; }
  .software-grid { grid-template-columns: 1fr; }
}

/* ─── Mobile Nav Bar ────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px; height: 38px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  padding: 7px 8px;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: all .25s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,39,68,.45);
  z-index: 99;
  backdrop-filter: blur(1px);
}
.sidebar-overlay.visible { display: block; }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .app-header { padding: .9rem 1.1rem; gap: .7rem; }
  .app-header h2 { font-size: 1.05rem; }
  .section { padding: 1rem; }
  .stats-row { padding: 1rem 1rem 0; }
  .software-grid, .cat-grid { padding: 1rem; }
  .table-wrap { margin: 0 1rem 1rem; }
  .locked-overlay-msg { margin: 0 1rem; }
}
