/* ================================================================
   KBPE Result System – Unified Stylesheet
   Kerala Board of Public Examinations
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tiro+Devanagari+Hindi&family=Source+Serif+4:wght@400;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

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

:root {
  --red:    #8B1A1A;
  --dred:   #6B1010;
  --gold:   #C8941A;
  --lgold:  #FBF0D8;
  --blue:   #003087;
  --lblue:  #EBF2FF;
  --green:  #1A6B1A;
  --lgreen: #E8F5E8;
  --bg:     #F2F0EB;
  --white:  #FFFFFF;
  --bdr:    #CCCAB8;
  --txt:    #1A1A1A;
  --mut:    #666655;
  --shadow: 0 2px 8px rgba(0,0,0,.12);
}

body {
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--txt);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── GOV BANNER ── */
.gov-banner {
  background: #1A3468;
  color: #fff;
  font-size: 11px;
  padding: 3px 14px;
  display: flex;
  justify-content: space-between;
}
.gov-banner a { color: #9BBFE8; margin: 0 4px; }

/* ── SITE HEADER ── */
.site-header {
  background: var(--white);
  border-bottom: 3px solid var(--red);
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-logo-img {
  width: 70px; height: 70px;
  object-fit: contain;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}
.header-title { flex: 1; }
.header-title .mal  { font-family: 'Tiro Devanagari Hindi', serif; font-size: 19px; color: var(--red); font-weight: 700; }
.header-title .eng  { font-family: 'Source Serif 4', serif; font-size: 13px; color: var(--blue); font-weight: 700; letter-spacing: .3px; }
.header-title .sub  { font-size: 10px; color: var(--mut); margin-top: 2px; }
.header-right { text-align: right; font-size: 10px; color: var(--mut); }
.gov-badges { display: flex; gap: 5px; margin-bottom: 4px; justify-content: flex-end; }
.gov-badge {
  border: 1px solid var(--bdr);
  padding: 2px 7px;
  font-size: 9px;
  text-align: center;
  border-radius: 2px;
  background: #f8f8f2;
}
.gov-badge strong { display: block; color: var(--red); font-size: 11px; }

/* ── MAIN NAV ── */
.main-nav { background: var(--red); display: flex; flex-wrap: wrap; }
.main-nav a {
  color: #fff; padding: 8px 13px; font-size: 12px; font-weight: 600;
  border-right: 1px solid rgba(255,255,255,.18);
  display: flex; align-items: center; gap: 5px;
  transition: background .15s;
}
.main-nav a:hover, .main-nav a.active { background: var(--dred); text-decoration: none; }
.main-nav a.home-btn { background: #1a1a2e; }
.sub-nav { background: var(--gold); display: flex; flex-wrap: wrap; }
.sub-nav a { color: var(--txt); padding: 4px 10px; font-size: 11px; border-right: 1px solid rgba(0,0,0,.12); }
.sub-nav a:hover { background: rgba(0,0,0,.09); text-decoration: none; }

/* ── NEWS TICKER ── */
.news-ticker { background: var(--blue); color: #fff; padding: 3px 0; font-size: 11px; display: flex; overflow: hidden; }
.ticker-label { background: var(--red); padding: 2px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.ticker-wrap { overflow: hidden; flex: 1; }
.ticker-content { white-space: nowrap; display: inline-block; animation: ticker 30s linear infinite; padding-left: 80%; }
@keyframes ticker { 0%{transform:translateX(0)} 100%{transform:translateX(-100%)} }

/* ── LAYOUT ── */
.main-wrapper { padding: 10px 12px; }
.layout3 { display: flex; gap: 8px; align-items: flex-start; }
.col-left  { width: 200px; flex-shrink: 0; }
.col-center{ flex: 1; min-width: 0; }
.col-right { width: 190px; flex-shrink: 0; }

/* ── SECTION BOX ── */
.sbox { background: var(--white); border: 1px solid var(--bdr); margin-bottom: 7px; border-radius: 2px; box-shadow: var(--shadow); }
.sbox-head { background: var(--red); color: #fff; padding: 6px 10px; font-size: 12px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; border-radius: 2px 2px 0 0; }
.sbox-head a { color: #FFD700; font-size: 10px; }
.sbox-body { padding: 8px 10px; }

/* ── NEWS ITEMS ── */
.news-item { border-bottom: 1px dashed var(--bdr); padding: 4px 0; font-size: 11px; display: flex; gap: 6px; align-items: flex-start; }
.news-item:last-child { border-bottom: none; }
.news-bullet { width: 6px; height: 6px; border-radius: 50%; background: var(--red); margin-top: 4px; flex-shrink: 0; }
.badge-new { background: var(--red); color: #fff; font-size: 9px; padding: 1px 4px; border-radius: 2px; animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1}50%{opacity:0} }

/* ── QUICK LINKS ── */
.qlink { display: flex; align-items: center; gap: 5px; padding: 4px 0; border-bottom: 1px dashed var(--bdr); font-size: 11px; color: var(--blue); }
.qlink:last-child { border-bottom: none; }
.qarr { color: var(--red); font-size: 10px; }

/* ── TABLES ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { background: var(--blue); color: #fff; padding: 6px 8px; text-align: left; font-weight: 600; }
.data-table td { padding: 5px 8px; border: 1px solid #ddd; }
.data-table tr:nth-child(even) td { background: #f5f5ff; }
.data-table tr:hover td { background: var(--lblue); }

/* ── BADGES ── */
.bdg { display: inline-block; padding: 2px 6px; font-size: 10px; border-radius: 3px; font-weight: 600; }
.bdg-pass { background: #D4EDDA; color: #155724; }
.bdg-fail { background: #F8D7DA; color: #721C24; }
.bdg-pend { background: #FFF3CD; color: #856404; }
.bdg-live { background: #CCE5FF; color: #004085; }
.bdg-new  { background: #8B1A1A; color: #fff; animation: blink 1.2s infinite; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; border-radius: 3px; transition: opacity .15s, transform .1s; font-family: inherit; }
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-r { background: var(--red); color: #fff; }
.btn-b { background: var(--blue); color: #fff; }
.btn-g { background: var(--green); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gray { background: #666; color: #fff; }
.btn-block { width: 100%; justify-content: center; }

/* ── FORM ELEMENTS ── */
.form-box { background: var(--lgold); border: 2px solid var(--gold); padding: 14px; border-radius: 3px; }
.form-box h4 { color: var(--red); text-align: center; font-size: 13px; margin-bottom: 10px; font-family: 'Source Serif 4', serif; }
.fgrp { margin-bottom: 8px; }
.fgrp label { font-size: 11px; font-weight: 700; display: block; margin-bottom: 3px; color: var(--txt); }
.fgrp input, .fgrp select, .fgrp textarea {
  width: 100%; padding: 6px 9px;
  border: 1px solid var(--bdr); font-size: 12px;
  border-radius: 3px; background: #fff; font-family: inherit;
  transition: border-color .2s;
}
.fgrp input:focus, .fgrp select:focus, .fgrp textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0,48,135,.1);
}
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── STAT CARDS ── */
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 10px; }
.stat-card { background: var(--white); border: 1px solid var(--bdr); padding: 10px; text-align: center; border-radius: 4px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 22px; font-weight: 700; color: var(--red); font-family: 'Source Serif 4', serif; }
.stat-card .lbl { font-size: 10px; color: var(--mut); margin-top: 2px; }

/* ── FOOTER ── */
.site-footer { background: var(--red); color: #fff; padding: 12px 14px; margin-top: 10px; }
.footer-top { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 8px; }
.footer-col h5 { font-size: 12px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.3); padding-bottom: 3px; }
.footer-col a { display: block; color: #FFD0D0; font-size: 10px; margin-bottom: 2px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.3); padding-top: 6px; display: flex; justify-content: space-between; font-size: 10px; color: #FFD0D0; flex-wrap: wrap; gap: 4px; }

/* ── RESULT SEARCH (public) ── */
.result-search-hero {
  background: linear-gradient(135deg, #8B1A1A 0%, #003087 100%);
  padding: 30px 20px;
  text-align: center;
  color: #fff;
}
.result-search-hero h2 { font-family: 'Source Serif 4', serif; font-size: 22px; margin-bottom: 4px; }
.result-search-hero p  { font-size: 12px; opacity: .85; margin-bottom: 20px; }
.search-bar {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.search-bar input {
  flex: 1; padding: 12px 16px; font-size: 15px;
  border: none; outline: none; font-family: 'DM Sans', sans-serif;
  letter-spacing: 2px; font-weight: 600;
}
.search-bar button {
  background: var(--gold); color: #fff; border: none;
  padding: 0 22px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: background .15s;
}
.search-bar button:hover { background: #a87a14; }

/* ── RESULT OUTPUT (public) ── */
.result-found-box {
  background: var(--lgreen);
  border: 2px solid var(--green);
  border-radius: 4px;
  padding: 14px;
  margin-top: 14px;
  display: none;
  animation: fadeIn .4s ease;
}
.result-found-box.show { display: block; }
.result-not-found {
  background: #FDE8E8;
  border: 2px solid #C0404040;
  border-radius: 4px;
  padding: 14px;
  margin-top: 14px;
  display: none;
  text-align: center;
  color: var(--red);
  animation: fadeIn .4s ease;
}
.result-not-found.show { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

.result-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; font-size: 12px; }
.result-meta-row { display: flex; gap: 6px; }
.result-meta-row .key { color: var(--mut); font-weight: 600; min-width: 110px; }
.result-meta-row .val { color: var(--txt); font-weight: 700; }

.pdf-open-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--red); color: #fff;
  padding: 12px 20px; border-radius: 4px;
  font-size: 14px; font-weight: 700;
  cursor: pointer; border: none;
  margin-top: 10px; width: 100%; justify-content: center;
  font-family: 'DM Sans', sans-serif;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.pdf-open-btn:hover { background: var(--dred); transform: translateY(-1px); text-decoration: none; color: #fff; }
.pdf-icon { font-size: 24px; }

/* ── ADMIN LAYOUT ── */
.admin-wrapper { display: flex; min-height: calc(100vh - 200px); }
.admin-sidebar {
  width: 210px;
  background: #1a1a2e;
  flex-shrink: 0;
  padding-top: 10px;
}
.admin-sidebar .sidebar-logo {
  text-align: center; padding: 12px 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 8px;
}
.admin-sidebar .sidebar-logo img { width: 56px; height: 56px; object-fit: contain; border-radius: 50%; border: 2px solid var(--gold); padding: 2px; background: #fff; }
.admin-sidebar .sidebar-logo p { color: #fff; font-size: 11px; margin-top: 6px; font-weight: 600; }
.admin-sidebar .sidebar-logo span { color: #9BBFE8; font-size: 10px; }

.sidebar-menu a {
  display: flex; align-items: center; gap: 9px;
  color: #BBC8E8; padding: 9px 16px; font-size: 12px; font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar-menu a:hover, .sidebar-menu a.active {
  background: rgba(255,255,255,.08);
  color: #fff; text-decoration: none;
  border-left-color: var(--gold);
}
.sidebar-menu a.active { color: #FFD700; }
.sidebar-menu .menu-icon { font-size: 15px; width: 20px; text-align: center; }
.sidebar-divider { border: none; border-top: 1px solid rgba(255,255,255,.1); margin: 6px 0; }

.admin-content { flex: 1; padding: 14px; min-width: 0; }
.admin-section { display: none; }
.admin-section.active { display: block; }

.admin-page-title {
  font-family: 'Source Serif 4', serif;
  font-size: 18px; font-weight: 700; color: var(--blue);
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--gold);
  display: flex; align-items: center; gap: 8px;
}

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--gold);
  border-radius: 6px;
  padding: 30px;
  text-align: center;
  background: var(--lgold);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 14px;
}
.upload-zone:hover { border-color: var(--red); background: #fdf5e0; }
.upload-zone .upload-icon { font-size: 40px; margin-bottom: 8px; }
.upload-zone p { color: var(--mut); font-size: 12px; }
.upload-zone strong { color: var(--red); }

/* ── FILE LIST ── */
.file-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 3px;
  border: 1px solid var(--bdr); margin-bottom: 5px;
  background: #fff; transition: background .15s;
}
.file-list-item:hover { background: var(--lblue); }
.file-icon { font-size: 22px; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-info .fname { font-weight: 700; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info .fmeta { font-size: 10px; color: var(--mut); }
.file-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* ── ADMIN LOGIN ── */
.admin-login-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #8B1A1A 100%);
}
.login-card {
  background: #fff; border-radius: 6px; padding: 36px 32px;
  width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
  text-align: center;
}
.login-card img { width: 72px; height: 72px; object-fit: contain; border-radius: 50%; border: 2px solid var(--gold); padding: 3px; margin-bottom: 12px; }
.login-card h2 { font-family: 'Source Serif 4', serif; color: var(--red); font-size: 18px; margin-bottom: 4px; }
.login-card p { color: var(--mut); font-size: 11px; margin-bottom: 20px; }
.login-card .fgrp input { padding: 9px 12px; font-size: 13px; }
.login-error { background: #FDEAEA; border: 1px solid #D08080; color: var(--red); padding: 7px 10px; border-radius: 3px; font-size: 11px; margin-bottom: 10px; display: none; }
.login-error.show { display: block; }

/* ── NOTICE ── */
.notice { padding: 8px 12px; border-radius: 3px; font-size: 12px; margin-bottom: 10px; }
.notice-success { background: var(--lgreen); border: 1px solid #80C080; color: var(--green); }
.notice-error   { background: #FDEAEA; border: 1px solid #D08080; color: var(--red); }
.notice-info    { background: var(--lblue); border: 1px solid #80A0D0; color: var(--blue); }
.notice-warn    { background: #FFF9E0; border: 1px solid #D0B040; color: #7a5c00; }

/* ── PRINT ── */
@media print {
  .gov-banner,.main-nav,.sub-nav,.news-ticker,.site-footer,
  .admin-sidebar,.no-print { display: none !important; }
}

/* ── RESPONSIVE ── */
@media (max-width:900px) {
  .layout3 { flex-direction:column; }
  .col-left,.col-right { width:100%; }
  .stat-cards { grid-template-columns:repeat(2,1fr); }
  .frow { grid-template-columns:1fr; }
  .admin-wrapper { flex-direction:column; }
  .admin-sidebar { width:100%; }
  .footer-top { grid-template-columns:1fr; }
}
