@import url('https://fonts.googleapis.com/css2?family=Poiret+One&display=swap');

/* ── Dark theme (default) ── */
:root {
    --bg: #0d1b2a;
    --surface: #111c2a;
    --surface2: #0f1a26;
    --border: #1e3048;
    --text: #e7ecff;
    --muted: #a0b8cc;
    --primary: steelblue;
    --plight: lightsteelblue;
    --accent: #4a90c4;
    --danger: #8b2020;
    --success: #3a8a4a;
    --radius: 10px;
    --gap: 16px;
    --max: 1100px;
    --nav-h: 70px;
    --font: 'Poiret One', cursive;
    --sm: 0.9rem;
}

/* ── Light theme ── */
html.light {
    --bg: #c8cdd5;
    --surface: #d8dde4;
    --surface2: #c0c5cc;

    --text: #0f172a;
    --muted: #334155;

    --primary: #2f5fa7;
    --plight: #1e3a8a;
    --accent: #1d4ed8;
}

html.light tr:nth-child(even) td {
    background: #f0f4f8;
}

html.light tr:hover td {
    background: #e8edf2;
}

/* ── Section themes ── */
html.theme-electronics {
    --primary: #b87c4a;
    --plight: #d4a574;
    --accent: #9a6535;
}

html.theme-web {
    --primary: #3a9a5c;
    --plight: #48995f;
    --accent: #2d7a48;
}

html.theme-apps {
    --primary: #2a9d8f;
    --plight: #4ac8ba;
    --accent: #1d7a70;
}

html:not(.light).theme-electronics {
    --bg: #1a120a;
    --surface: #241910;
    --surface2: #1e1509;
    --border: #3a2a1a;
}

html:not(.light).theme-web {
    --bg: #0a1a0f;
    --surface: #0f2415;
    --surface2: #0c1e11;
    --border: #1a3a22;
}

html:not(.light).theme-apps {
    --bg: #091a1a;
    --surface: #0d2424;
    --surface2: #0a1e1e;
    --border: #1a3a3a;
}

html.light.theme-electronics {
    --bg: #fdf6f0;
    --surface: #fff8f2;
    --surface2: #f5ede3;
}

html.light.theme-web {
    --bg: #f0faf3;
    --surface: #f7fff9;
    --surface2: #e8f5ec;
    --border: #499160;
}

html.light.theme-apps {
    --bg: #f0fafa;
    --surface: #f7fffe;
    --surface2: #e4f5f5;
}

/* ── Contacts Theme ── */
html.theme-contacts {
    --primary: #9b59b6;
    /* purple */
    --plight: #c084e8;
    --accent: #7d3cb5;
}

/* Dark mode background */
html:not(.light).theme-contacts {
    --bg: #160a1f;
    --surface: #1f0f2a;
    --surface2: #190d23;
    --border: #3a1a4d;
}

/* Light mode background */
html.light.theme-contacts {
    --bg: #faf5ff;
    --surface: #ffffff;
    --surface2: #f3e8ff;
}

html.theme-security {
    --primary: #c0392b;
    --plight: #ff6b5e;
    --accent: #922b21;
}

html:not(.light).theme-security {
    --bg: #1a0a0a;
    --surface: #241010;
    --surface2: #1e0c0c;
    --border: #3a1a1a;
}

html.light.theme-security {
    --bg: #fff5f5;
    --surface: #ffffff;
    --surface2: #fdeaea;
}

html.theme-finance {
    --primary: #d4af37;
    --plight: #b6a255;
    --accent: #b8962e;
}

html:not(.light).theme-finance {
    --bg: #1a160a;
    --surface: #242010;
    --surface2: #1e1a09;
    --border: #3a341a;
}

html.light.theme-finance {
    --bg: #fffbea;
    --surface: #ffffff;
    --surface2: #f9f3d2;
}

html {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1.5rem;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    line-height: 1.7;
}

main {
    flex: 1;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
    border-radius: 10px;
}

a {
    color: var(--plight);
    text-decoration: none;
    transition: color .2s;
}

a:hover {
    color: var(--primary);
}

p {
    color: var(--muted);
    line-height: 1.75;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font);
    font-weight: bold;
    color: var(--plight);
    line-height: 1.3;
    margin-top: 20px;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

h2 {
    font-size: clamp(1.2rem, 2.8vw, 1.8rem);
}

h3 {
    font-size: 1.1rem;
}

/* ── Header / Nav ── */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: var(--nav-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 8px 20px;
    backdrop-filter: blur(6px);
}

header>nav {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
}

aside {
    width: stretch;
}

.logo-box img {
    height: 44px;
    border-radius: 6px;
}

.site-name {
    font-size: 1.15rem;
    color: var(--plight);
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

nav.nav-links {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

nav.nav-links a {
    color: var(--muted);
    font-size: var(--sm);
    padding: 6px 13px;
    border-radius: var(--radius);
    transition: background .2s, color .2s;
    white-space: nowrap;
}

nav.nav-links a:hover,
nav.nav-links a.active {
    background: var(--primary);
    color: white;
}

/* Theme toggle */
#theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: var(--radius);
    padding: 5px 10px;
    font-size: .85rem;
    cursor: pointer;
    transition: border-color .2s, color .2s;
    white-space: nowrap;
    flex-shrink: 0;
}

#theme-toggle:hover {
    border-color: var(--primary);
    color: var(--plight);
}

/* Hamburger */
.hamburger-box {
    display: none;
}

.hamburger {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
}

.hamburger .line {
    width: 26px;
    height: 2px;
    background: var(--plight);
    border-radius: 2px;
}

/* ── Footer ── */
footer {
    min-height: 44px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: var(--sm);
    padding: 10px 24px;
    text-align: center;
    flex-wrap: wrap;
    gap: 8px;
}

footer a {
    color: var(--muted);
}

footer a:hover {
    color: var(--plight);
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 9px 20px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all .2s;
    background: var(--primary);
    color: white;
    text-decoration: none;
}

button {
    font-family: var(--font);
    cursor: pointer;
}

.btn:hover {
    background: var(--accent);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--plight);
    border: 2px solid var(--plight);
}

.btn-outline:hover {
    background: var(--plight);
    color: var(--bg);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* ── Inputs ── */
input,
select,
textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 9px 13px;
    font-family: var(--font);
    font-size: 1rem;
    box-sizing: border-box;
    width: 100%;
    transition: border-color .2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

input[type=checkbox],
input[type=radio],
input[type=range] {
    width: auto;
    padding: 0;
    accent-color: var(--primary);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

label {
    font-size: var(--sm);
    color: var(--muted);
    display: block;
    margin-bottom: 4px;
}

/* ── Card ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    transition: border-color .2s, transform .2s;
}

.card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.card h3 {
    margin-bottom: 8px;
}

.card p {
    font-size: var(--sm);
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 30px 26px;
    max-width: 560px;
    width: 100%;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.3rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--plight);
}

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--sm);
}

th {
    background: var(--surface2);
    color: var(--plight);
    padding: 10px 13px;
    border-bottom: 2px solid var(--border);
    text-align: left;
    font-weight: bold;
}

td {
    padding: 9px 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

tr:nth-child(even) td {
    background: var(--surface2);
}

tr:hover td {
    background: var(--surface);
}

/* ── Guide cards ── */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--gap);
    margin-top: 16px;
}

.guide-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    color: var(--text);
    transition: border-color .2s, transform .2s;
}

.guide-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    color: var(--text);
}

.guide-card h3 {
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.guide-card p {
    font-size: var(--sm);
    margin-bottom: 12px;
}

.guide-meta {
    font-size: var(--sm);
    color: var(--primary);
}

/* ── Wrap ── */
.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 52px 28px;
    width: 100%;
}

/* ── Utilities ── */
.tac {
    text-align: center;
}

.muted {
    color: var(--muted);
}

.hidden {
    display: none !important;
}

.label {
    font-size: .72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary);
    display: block;
    margin-bottom: 8px;
}

.auth-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 22px;
    font-size: var(--sm);
}

.auth-bar p {
    margin: 0;
    color: var(--muted);
}

#auth-label {
    color: var(--plight);
    font-weight: bold;
}

#auth-btn {
    padding: 5px 12px;
    margin: 0;
    font-size: 0.8rem;
}

#login-inline {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    max-width: 300px;
    margin-bottom: 20px;
    display: none;
}

#login-inline h3 {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

#login-inline input {
    margin-bottom: 8px;
}

/* ── HERO SECTION ── */
.hero {
    min-height: 55vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 72px 24px 52px;

    /* THEME SAFE */
    background: linear-gradient(160deg,
            var(--bg),
            var(--surface2) 55%,
            var(--bg));
}

.hero h1 {
    font-size: clamp(2.4rem, 6vw, 3.8rem);
    color: var(--plight);
    text-shadow: 0 2px 20px rgba(0, 0, 0, .4);
    margin-bottom: 16px;
}

.hero p {
    max-width: 600px;
    margin: 0 auto 32px;
    line-height: 1.8;
    color: var(--muted);
}

/* ── Responsive ── */
@media (max-width:768px) {
    .hamburger-box {
        display: flex;
        align-items: center;
    }

    #theme-toggle {
        font-size: .75rem;
        padding: 4px 8px;
    }

    nav {
        width: auto;
    }

    nav.nav-links {
        display: none;
        position: absolute;
        top: var(--nav-h);
        left: 0;
        right: 0;
        box-sizing: border-box;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 12px 16px;
        gap: 4px;
        z-index: 99;
        overflow: auto;
    }

    nav.nav-links.active {
        display: flex;
        flex-direction: row;
        width: stretch;
    }

    nav.nav-links a {
        width: 100%;
        margin: 0 auto;
        text-align: center;
        padding: 13px;
        width: stretch;
        width: -webkit-fill-available;
    }

    .site-name {
        font-size: .95rem;
    }

    .wrap {
        padding: 30px 16px;
        width: auto;
    }

    .btn {
        margin-bottom: 10px;
    }
}

/* ── Print ── */
@media print {
    body * {
        visibility: hidden;
    }

    #printableDiv,
    #printableDiv * {
        visibility: visible;
    }

    #printableDiv {
        position: absolute;
        left: 0;
        top: 0;
    }

    header,
    footer,
    button,
    nav,
    .modal-overlay {
        display: none;
    }

    body {
        background: white;
        color: black;
    }
}