/* Orange-Purple — Insait Apps Theme */
:root {
    --orange: #ff6b00;
    --orange-light: #ff8c00;
    --orange-dark: #cc5500;
    --purple: #6a0dad;
    --purple-light: #9b30d0;
    --purple-dark: #450a7d;
    --bg-dark: #1a0a2e;
    --bg-card: #2a1050;
    --text-light: #f0e6ff;
    --text-muted: #c4a8e8;
    --border: rgba(255, 107, 0, 0.3);
    --shadow: 0 4px 24px rgba(106, 13, 173, 0.4);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.6;
}

/* ── NAVIGATION ────────────────────────────────────────────── */
nav {
    background: linear-gradient(90deg, var(--purple-dark) 0%, var(--purple) 50%, var(--orange-dark) 100%);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
}

nav .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    padding: 1rem 0.5rem 1rem 0;
    letter-spacing: 1px;
    white-space: nowrap;
}

nav .brand-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

nav .brand-text {
    display: inline-flex;
    align-items: center;
}

nav .brand span {
    color: var(--orange-light);
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

/* Nav panel: flex row on desktop, collapsible column on mobile */
.nav-panel {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 0;
    flex: 1;
}

.nav-links li a {
    display: block;
    color: var(--text-light);
    text-decoration: none;
    padding: 1rem 1.0rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.nav-links li a:hover,
.nav-links li a.active {
    background: rgba(255, 107, 0, 0.25);
    color: var(--orange-light);
}

.nav-links li a.active {
    border-bottom: 3px solid var(--orange-light);
}

/* Lightweight app glyphs inside nav links — desktop uses inline text */
.nav-app-icon {
    display: inline-block;
}

.nav-app-label {
    display: inline;
}

/* Drawer close button & backdrop — desktop: hidden entirely */
.nav-backdrop {
    display: none;
}

.drawer-close {
    display: none;
}

/* Scroll lock when the mobile drawer is open */
body.menu-open {
    overflow: hidden;
}

/* ── HERO / HEADER ─────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--bg-dark) 60%, var(--orange-dark) 100%);
    text-align: center;
    padding: 4rem 2rem 3rem;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(90deg, var(--orange-light), var(--purple-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

/* Emoji/icon inside hero h1 — reset gradient so it shows in full color */
.hero h1 .hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-text-fill-color: initial;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    font-style: normal;
}

.hero-brand-logo {
    height: 1em;
    width: auto;
    object-fit: contain;
    display: block;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ── MAIN CONTENT ──────────────────────────────────────────── */
main {
    max-width: 960px;
    margin: 2.5rem auto;
    padding: 0 1.5rem 4rem;
}

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.5rem;
    color: var(--orange-light);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.card h3 {
    color: var(--purple-light);
    margin: 1rem 0 0.5rem;
}

.card p,
.card li {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card ul {
    padding-left: 1.4rem;
}

/* ── SKILLS GRID ───────────────────────────────────────────── */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.skill-badge {
    background: linear-gradient(135deg, var(--purple) 0%, var(--orange-dark) 100%);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
}

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: filter 0.2s, transform 0.1s;
}

.btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(90deg, var(--orange), var(--orange-dark));
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(90deg, var(--purple), var(--purple-dark));
    color: #fff;
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
}

/* ── FORM ELEMENTS ─────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    color: var(--orange-light);
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.92rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-light);
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--orange-light);
}

.form-group select option {
    background: var(--bg-card);
}

/* ── RESULT BOXES ──────────────────────────────────────────── */
.result-box {
    background: rgba(255, 107, 0, 0.12);
    border: 1px solid var(--orange-dark);
    border-radius: 10px;
    padding: 1.25rem;
    margin-top: 1.25rem;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--orange-light);
}

/* ── TODO LIST ─────────────────────────────────────────────── */
.todo-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    opacity: 0.5;
}

.todo-text {
    flex: 1;
}

/* ── QUIZ ──────────────────────────────────────────────────── */
.quiz-option {
    display: block;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
    cursor: pointer;
    transition: background 0.2s;
}

.quiz-option:hover {
    background: rgba(255, 107, 0, 0.15);
}

.quiz-option.correct {
    background: rgba(0, 200, 100, 0.2);
    border-color: #00c864;
}

.quiz-option.wrong {
    background: rgba(220, 50, 50, 0.2);
    border-color: #dc3232;
}

/* ── CALCULATOR ────────────────────────────────────────────── */
.calc-display {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    text-align: right;
    font-size: 2rem;
    font-weight: 700;
    color: var(--orange-light);
    margin-bottom: 1rem;
    min-height: 3.5rem;
    word-break: break-all;
}

.calc-display .expr {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-height: 1.2rem;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}

.calc-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 1.15rem;
    font-weight: 600;
    padding: 1rem 0.5rem;
    cursor: pointer;
    transition: background 0.15s;
}

.calc-btn:hover {
    background: rgba(255, 107, 0, 0.25);
}

.calc-btn.op {
    color: var(--orange-light);
}

.calc-btn.eq {
    background: linear-gradient(135deg, var(--orange), var(--orange-dark));
    color: #fff;
}

.calc-btn.eq:hover {
    filter: brightness(1.1);
}

.calc-btn.clr {
    color: #ff6060;
}

/* ── CONVERTER ─────────────────────────────────────────────── */
.converter-result {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--purple-light);
    text-align: center;
    padding: 1rem;
}

/* ── CHECKBOX LABEL ────────────────────────────────────────── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--orange);
    cursor: pointer;
}

/* ── PASSWORD GENERATOR ────────────────────────────────────── */
.pw-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
}

.pw-value {
    flex: 1;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.92rem;
    word-break: break-all;
    color: var(--orange-light);
}

/* ── TEXT ANALYZER ─────────────────────────────────────────── */
.form-group textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-light);
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    border-color: var(--orange-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-item--wide {
    grid-column: 1 / -1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--orange-light);
}

/* ── CUSTOM FILE PICKER ───────────────────────────────────── */
.file-picker {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-picker .file-name {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── FILE INPUT ────────────────────────────────────────────── */
.form-group input[type="file"] {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-light);
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
    outline: none;
    width: 100%;
    cursor: pointer;
}

.form-group input[type="file"]::file-selector-button {
    background: linear-gradient(90deg, var(--purple), var(--purple-dark));
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    margin-right: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.form-group input[type="file"]::file-selector-button:hover {
    filter: brightness(1.15);
}

/* ── FOOTER ────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    background: var(--purple-dark);
}

footer a {
    color: var(--orange-light);
    text-decoration: underline;
    text-underline-offset: 2px;
}

footer a:hover,
footer a:focus-visible {
    color: #fff;
    text-decoration: underline;
}

/* Links inside body content — keep a non-colour indicator */
main a:not(.btn):not(.lang-btn) {
    color: var(--orange-light);
    text-decoration: underline;
    text-underline-offset: 2px;
}

main a:not(.btn):not(.lang-btn):hover,
main a:not(.btn):not(.lang-btn):focus-visible {
    color: #fff;
}

/* Visible keyboard focus indicator */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--orange-light);
    outline-offset: 2px;
    border-radius: 4px;
}


/* ── LANGUAGE SWITCHER ─────────────────────────────────────── */
.lang-switcher {
    display: flex;
    gap: 0.25rem;
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-light);
    padding: 0.25rem 0.45rem;
    font-size: 0.76rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
}

.lang-btn:hover {
    background: rgba(255, 107, 0, 0.3);
}

.lang-btn.lang-active {
    background: linear-gradient(90deg, var(--orange), var(--orange-dark));
    border-color: var(--orange);
    color: #fff;
}

/* ── SECTION HEADER ────────────────────────────────────────── */
.section-header {
    margin: 2.5rem 0 1rem;
}

.section-header h2 {
    font-size: 1.6rem;
    color: var(--orange-light);
    font-weight: 700;
}

.section-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* ── APPS GRID ─────────────────────────────────────────────── */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(106, 13, 173, 0.55);
}

.app-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.app-icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.app-card h2 {
    font-size: 1.25rem;
    color: var(--orange-light);
    margin: 0;
}

.app-card p {
    color: var(--text-muted);
    flex: 1;
    margin: 0;
}

.app-card code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

.app-card--dev {
    opacity: 0.7;
    border-style: dashed;
}

.dev-badge {
    display: inline-block;
    background: rgba(255, 107, 0, 0.15);
    border: 1px solid var(--orange-dark);
    color: var(--orange-light);
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    align-self: flex-start;
}

/* ── MOBILE NAV ────────────────────────────────────────────── */
/* Only for phone screens; desktop navigation remains unchanged. */
@media (max-width: 700px) {
    nav {
        padding: 0 1rem;
    }

    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.15);
        transition: background 0.2s, border-color 0.2s;
    }

    .nav-toggle:hover {
        background: rgba(255, 107, 0, 0.3);
        border-color: var(--orange-light);
    }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 900;
        background: rgba(10, 4, 22, 0.6);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .nav-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    .nav-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(100%, 420px);
        z-index: 1000;
        background: linear-gradient(170deg, var(--purple-dark) 0%, var(--bg-card) 45%, var(--bg-dark) 100%);
        border-left: 1px solid var(--border);
        box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
        padding: 0;
        transform: translateX(100%);
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .nav-panel.open {
        transform: translateX(0);
    }

    .drawer-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
        width: 42px;
        height: 42px;
        font-size: 1.05rem;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 10px;
        color: var(--text-light);
        cursor: pointer;
        z-index: 10;
        transition: background 0.2s, color 0.2s, transform 0.2s;
    }

    .drawer-close:hover {
        background: rgba(255, 107, 0, 0.3);
        color: #fff;
        transform: rotate(90deg);
    }

    .nav-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
        padding: 1.35rem 1.25rem 1.25rem;
        flex: 1 1 auto;
        align-content: start;
    }

    .nav-links li {
        list-style: none;
    }

    .nav-links li a {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.55rem;
        padding: 0.9rem 0.85rem;
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        color: var(--text-light);
        font-size: 0.85rem;
        font-weight: 600;
        text-decoration: none;
        white-space: nowrap;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
    }

    .nav-links li a:hover {
        background: rgba(255, 107, 0, 0.16);
        border-color: var(--orange-light);
        color: var(--orange-light);
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(255, 107, 0, 0.25);
    }

    .nav-links li a:active {
        transform: scale(0.96);
        background: rgba(255, 107, 0, 0.28);
    }

    .nav-links li a.active {
        background: linear-gradient(135deg, var(--purple) 0%, var(--orange-dark) 100%);
        border-color: transparent;
        color: #fff;
        box-shadow: 0 4px 16px rgba(106, 13, 173, 0.5);
    }

    .nav-app-icon {
        font-size: 1.15rem;
        line-height: 1;
        flex-shrink: 0;
    }

    .nav-app-label {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .lang-switcher {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.05);
        border-top: 1px solid var(--border);
    }

    .lang-btn {
        flex: 0 1 auto;
        padding: 0.45rem 0.85rem;
        font-size: 0.78rem;
        text-align: center;
    }
}

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

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.flex-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
}

.alert-success {
    background: rgba(0, 200, 100, 0.15);
    border: 1px solid #00c864;
    color: #00c864;
}

.alert-danger {
    background: rgba(220, 50, 50, 0.15);
    border: 1px solid #dc3232;
    color: #ff7070;
}

.alert-info {
    background: rgba(106, 13, 173, 0.2);
    border: 1px solid var(--purple-light);
    color: var(--purple-light);
}