/* ===== BASE & RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:          #1a3a6b;
    --primary-dark:     #102a52;
    --primary-light:    #2563eb;
    --primary-lighter:  #dbeafe;
    --accent:           #3b82f6;
    --text:             #0f172a;
    --text-muted:       #64748b;
    --white:            #ffffff;
    --bg-alt:           #f0f6ff;
    --border:           #e2e8f0;
    --success:          #166534;
    --success-bg:       #dcfce7;
    --error:            #991b1b;
    --error-bg:         #fee2e2;
    --warning:          #92400e;
    --warning-bg:       #fef3c7;
    --shadow-sm:  0 1px 3px rgba(26,58,107,0.08);
    --shadow-md:  0 4px 12px rgba(26,58,107,0.12);
    --shadow-lg:  0 10px 30px rgba(26,58,107,0.18);
    --radius:     8px;
    --radius-lg:  16px;
    --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }
img  { max-width: 100%; height: auto; display: block; }
a    { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }

/* ===== LAYOUT ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ===== HEADER & NAVIGATION ===== */
.site-header { background: var(--primary); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-md); }

.main-nav { background: transparent; }

.main-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    position: relative;
}

.nav-logo { display: flex; align-items: center; flex-shrink: 0; margin-right: 32px; }
.nav-logo img {
    height: 44px;
    width: auto;
    filter: brightness(0) invert(1);
}

.nav-list { display: flex; list-style: none; }

.nav-list a {
    display: block;
    padding: 0 22px;
    height: 68px;
    line-height: 68px;
    color: rgba(255,255,255,0.82);
    font-weight: 500;
    font-size: 15px;
    transition: background var(--transition), color var(--transition);
}
.nav-list a:hover, .nav-list a.active {
    background: rgba(255,255,255,0.12);
    color: var(--white);
}

.nav-portal-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 22px;
    height: 68px;
    line-height: 68px;
    color: rgba(255,255,255,0.82);
    font-weight: 500;
    font-size: 15px;
    transition: background var(--transition), color var(--transition);
}
.nav-portal-btn:hover, .nav-portal-btn.active {
    background: rgba(255,255,255,0.12);
    color: var(--white);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    margin-left: auto;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--white); border-radius: 2px; transition: all var(--transition); }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, #f0f6ff 0%, #ffffff 65%);
    color: var(--text);
    padding: 80px 0 100px;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}
.hero::before {
    content: '';
    position: absolute; top: -30%; right: -6%;
    width: 520px; height: 520px;
    background: var(--primary-lighter);
    border-radius: 50%; pointer-events: none; opacity: 0.45;
}
.hero::after {
    content: '';
    position: absolute; bottom: -25%; left: -4%;
    width: 360px; height: 360px;
    background: var(--primary-lighter);
    border-radius: 50%; pointer-events: none; opacity: 0.25;
}
.hero-content { max-width: 680px; position: relative; z-index: 1; }

.hero-tag {
    display: inline-block;
    background: var(--primary-lighter);
    color: var(--primary);
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase;
    padding: 6px 16px; border-radius: 20px;
    margin-bottom: 22px;
}

.hero h1 {
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 700; line-height: 1.2;
    color: var(--primary);
    margin-bottom: 18px;
}
.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 36px;
    max-width: 530px;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-weight: 600; font-size: 15px;
    text-decoration: none; cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent; line-height: 1;
    font-family: inherit;
}
.btn-primary { background: var(--white); color: var(--primary); }
.btn-primary:hover { background: var(--bg-alt); color: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-outline { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.5); }
.btn-outline:hover { background: rgba(255,255,255,0.1); border-color: var(--white); color: var(--white); }

.btn-blue { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-blue:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-sm {
    padding: 7px 16px; font-size: 13px;
    border-radius: 6px; font-weight: 600;
    text-decoration: none; border: none; cursor: pointer;
    font-family: inherit;
    display: inline-flex; align-items: center; gap: 4px;
    transition: all var(--transition);
}
.btn-sm-blue   { background: var(--primary); color: var(--white); }
.btn-sm-blue:hover { background: var(--primary-dark); color: var(--white); }
.btn-sm-green  { background: var(--success-bg); color: var(--success); }
.btn-sm-green:hover { background: #bbf7d0; }
.btn-sm-red    { background: var(--error-bg); color: var(--error); }
.btn-sm-red:hover { background: #fca5a5; }
.btn-sm-gray   { background: var(--border); color: var(--text-muted); }
.btn-sm-gray:hover { background: #cbd5e1; color: var(--text); }

/* ===== SECTIONS ===== */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }

.section-header { text-align: center; margin-bottom: 48px; }

.section-tag {
    display: inline-block;
    background: var(--primary-lighter); color: var(--primary);
    font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    padding: 5px 14px; border-radius: 20px; margin-bottom: 12px;
}

.section-header h2 {
    font-size: clamp(1.6rem, 3vw, 2.25rem);
    font-weight: 700; color: var(--primary); margin-bottom: 12px;
}
.section-header p { font-size: 1.0625rem; color: var(--text-muted); max-width: 560px; margin: 0 auto; }

/* ===== CARDS ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }

.card {
    background: var(--white);
    border-radius: var(--radius-lg); padding: 32px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }

.card-icon {
    width: 56px; height: 56px;
    background: var(--primary-lighter); border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 20px; color: var(--primary);
}
.card h3 { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.card p  { color: var(--text-muted); font-size: 15px; }

/* ===== INFO BANNER ===== */
.info-banner { background: var(--primary); color: var(--white); padding: 56px 0; text-align: center; }
.info-banner h2 { font-size: 1.8rem; font-weight: 700; margin-bottom: 12px; }
.info-banner p  { color: rgba(255,255,255,0.8); font-size: 1.0625rem; margin-bottom: 28px; }

.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; text-align: center; max-width: 860px; margin: 0 auto; }

.contact-item {
    padding: 24px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: var(--radius);
}
.contact-item .label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: rgba(255,255,255,0.55); margin-bottom: 8px;
}
.contact-item .value { font-size: 1rem; font-weight: 600; color: var(--white); overflow-wrap: break-word; word-break: break-word; }
.contact-item a { color: var(--white); overflow-wrap: break-word; word-break: break-word; }
.contact-item a:hover { color: rgba(255,255,255,0.75); }

/* ===== PAGE HEADER ===== */
.page-header {
    background: var(--bg-alt);
    color: var(--text);
    padding: 44px 0;
    border-bottom: 1px solid var(--border);
}
.page-header h1 {
    font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 700;
    color: var(--primary);
}
.page-header p  { color: var(--text-muted); margin-top: 8px; font-size: 1.0625rem; }

/* ===== CONTENT PAGES ===== */
.content-page { padding: 56px 0; }
.content-wrap { max-width: 820px; }

.content-page h2 { font-size: 1.35rem; font-weight: 700; color: var(--primary); margin: 36px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--primary-lighter); }
.content-page h3 { font-size: 1.05rem; font-weight: 600; color: var(--text); margin: 22px 0 8px; }
.content-page p  { color: var(--text-muted); margin-bottom: 14px; text-align: justify; hyphens: auto; }
.content-page ul, .content-page ol { color: var(--text-muted); padding-left: 24px; margin-bottom: 14px; }
.content-page li { margin-bottom: 6px; text-align: justify; hyphens: auto; }

.info-box {
    background: var(--bg-alt);
    border-left: 4px solid var(--primary-light);
    padding: 16px 20px; border-radius: 0 var(--radius) var(--radius) 0;
    margin: 20px 0; font-size: 14px; color: var(--text-muted);
}

/* ===== LOGIN ===== */
.login-page {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 48px 24px; background: var(--bg-alt);
}
.login-card {
    background: var(--white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); padding: 48px;
    width: 100%; max-width: 440px;
}
.login-card .logo-wrap { text-align: center; margin-bottom: 32px; }
.login-card .logo-wrap img { height: 50px; margin: 0 auto; }
.login-card h1 { font-size: 1.5rem; font-weight: 700; color: var(--primary); text-align: center; margin-bottom: 6px; }
.login-card .subtitle { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: 15px; font-family: inherit; color: var(--text);
    background: var(--white); outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-group textarea { min-height: 100px; resize: vertical; }

.form-submit {
    width: 100%; padding: 13px;
    background: var(--primary); color: var(--white);
    border: none; border-radius: var(--radius);
    font-size: 16px; font-weight: 600; cursor: pointer;
    transition: background var(--transition); font-family: inherit;
}
.form-submit:hover { background: var(--primary-dark); }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500; margin-bottom: 20px; }
.alert-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid #fca5a5; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fcd34d; }

/* ===== PORTAL ===== */
.portal-wrapper { display: flex; min-height: calc(100vh - 200px); }

.portal-sidebar {
    width: 240px; flex-shrink: 0;
    background: var(--primary); padding: 28px 0;
}
.portal-sidebar .user-info {
    padding: 0 20px 20px; margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.portal-sidebar .user-name { font-weight: 600; color: var(--white); font-size: 15px; }
.portal-sidebar .user-role { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 2px; }

.portal-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7); font-weight: 500; font-size: 14.5px;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}
.portal-nav a:hover, .portal-nav a.active {
    background: rgba(255,255,255,0.1); color: var(--white);
}
.portal-nav .nav-section {
    font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: rgba(255,255,255,0.35); padding: 20px 20px 6px; margin-top: 8px;
}
.portal-nav a.logout { color: rgba(255,100,100,0.7); }
.portal-nav a.logout:hover { background: rgba(255,50,50,0.1); color: #fca5a5; }

.portal-content { flex: 1; padding: 40px; background: var(--bg-alt); }
.portal-content h1 { font-size: 1.75rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.portal-content .page-sub { color: var(--text-muted); margin-bottom: 32px; font-size: 15px; }

/* ===== DOWNLOAD LIST ===== */
.download-list { display: grid; gap: 14px; }

.download-item {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px 24px;
    display: flex; align-items: center; gap: 20px;
    transition: box-shadow var(--transition);
}
.download-item:hover { box-shadow: var(--shadow-md); }

.dl-icon {
    width: 48px; height: 48px; flex-shrink: 0;
    background: var(--primary-lighter); border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
}
.dl-info { flex: 1; }
.dl-info h3 { font-weight: 600; color: var(--text); font-size: 15px; margin-bottom: 3px; }
.dl-info p  { font-size: 13.5px; color: var(--text-muted); }
.dl-info .version { font-size: 12px; color: var(--primary-light); font-weight: 600; margin-top: 4px; }

.btn-dl {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 20px;
    background: var(--primary); color: var(--white);
    border-radius: var(--radius); font-weight: 600; font-size: 14px;
    text-decoration: none; transition: background var(--transition);
    white-space: nowrap;
}
.btn-dl:hover { background: var(--primary-dark); color: var(--white); }

/* ===== ADMIN ===== */
.admin-wrapper { display: flex; min-height: calc(100vh - 200px); }

.admin-sidebar { width: 220px; flex-shrink: 0; background: #0f172a; padding: 20px 0; }
.admin-brand {
    padding: 0 20px 18px; margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: rgba(255,255,255,0.4);
}
.admin-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.6); font-size: 14px; font-weight: 500;
    text-decoration: none; transition: background var(--transition), color var(--transition);
}
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,0.07); color: var(--white); }
.admin-nav a.logout { color: rgba(255,100,100,0.6); margin-top: 8px; }
.admin-nav a.logout:hover { color: #fca5a5; background: rgba(255,50,50,0.07); }

.admin-content { flex: 1; padding: 36px; background: #f8fafc; }
.admin-content h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.admin-content .page-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .num { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-card .lbl { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.admin-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.admin-card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-alt);
}
.admin-card-header h2 { font-size: 15px; font-weight: 700; color: var(--text); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 11px 16px; text-align: left;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-muted);
    background: var(--bg-alt); border-bottom: 1px solid var(--border);
}
.data-table td { padding: 13px 16px; border-top: 1px solid var(--border); font-size: 14px; }
.data-table tr:hover td { background: #fafbfc; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-on  { background: var(--success-bg); color: var(--success); }
.badge-off { background: var(--error-bg);   color: var(--error); }
.badge-adm { background: var(--primary-lighter); color: var(--primary); }

.form-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.form-panel h2 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.checkbox-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.checkbox-label {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; border: 1.5px solid var(--border); border-radius: 6px;
    cursor: pointer; font-size: 13.5px; font-weight: 500; transition: all var(--transition);
}
.checkbox-label:hover { border-color: var(--primary-light); background: var(--primary-lighter); }
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.checkbox-label input:checked + span { color: var(--primary); }

/* ===== FOOTER ===== */
.site-footer { background: #f8fafc; color: var(--text-muted); padding: 20px 0; border-top: 1px solid var(--border); }

.footer-inner {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px;
    padding-bottom: 16px; margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a { font-size: 14px; font-weight: 500; color: var(--text); transition: color var(--transition); }
.footer-links a:hover { color: var(--primary); }

.footer-contact { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.fc-item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px;
    font-size: 13.5px; font-weight: 500;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    text-decoration: none;
    transition: all var(--transition);
}
.fc-item svg { color: var(--primary); flex-shrink: 0; }
a.fc-item:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lighter); }
.fc-addr { cursor: default; }

.footer-bottom {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; flex-wrap: wrap; gap: 10px;
}
.footer-bottom-links { display: flex; gap: 18px; }
.footer-bottom-links a { color: var(--text-muted); font-size: 13px; transition: color var(--transition); }
.footer-bottom-links a:hover { color: var(--primary); }

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-3 { margin-bottom: 24px; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state p { font-size: 15px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .nav-list {
        display: none; flex-direction: column;
        position: absolute; top: 100%; left: 0; right: 0;
        background: var(--primary-dark); z-index: 100;
        box-shadow: var(--shadow-lg);
    }
    .nav-list.open { display: flex; }
    .nav-list a { height: auto; line-height: 1; padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,0.07); }
    .nav-portal-btn { display: none; }

    .footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
    .footer-bottom { flex-direction: column; gap: 8px; }

    .portal-wrapper, .admin-wrapper { flex-direction: column; }
    .portal-sidebar, .admin-sidebar { width: 100%; padding: 12px 0; }
    .portal-content, .admin-content { padding: 24px 16px; }

    .download-item { flex-wrap: wrap; }
    .login-card { padding: 32px 20px; }
    .hero { padding: 56px 0 72px; }
    .section { padding: 48px 0; }
    .cards-grid { grid-template-columns: 1fr; }
    .admin-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .cards-grid { grid-template-columns: 1fr; }
    .admin-stats { grid-template-columns: 1fr; }
}
