/* =========================================================
   InstantArticle.net
   Global UI / UX Styles
   ========================================================= */


/* =========================================================
   VARIABLES
   ========================================================= */

:root {
    --bg: #f5f7fb;

    --surface: #ffffff;
    --surface-soft: #f9fafb;

    --text: #111827;
    --text-soft: #4b5563;
    --muted: #6b7280;

    --border: #e5e7eb;
    --border-strong: #d1d5db;

    --primary: #111827;
    --primary-hover: #1f2937;

    --blue-bg: #eff6ff;
    --blue-text: #1d4ed8;

    --green-bg: #ecfdf5;
    --green-text: #166534;

    --amber-bg: #fff7ed;
    --amber-text: #9a3412;

    --red-bg: #fef2f2;
    --red-text: #991b1b;

    --violet-bg: #f5f3ff;
    --violet-text: #6d28d9;

    --shadow-sm:
        0 4px 16px rgba(17, 24, 39, 0.05);

    --shadow-md:
        0 10px 30px rgba(17, 24, 39, 0.08);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    --container: 1120px;
}


/* =========================================================
   RESET
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background: var(--bg);
    color: var(--text);

    line-height: 1.6;
}

img {
    display: block;

    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}


/* =========================================================
   MAIN LAYOUT
   ========================================================= */

.site-container {
    width: min(
        calc(100% - 32px),
        var(--container)
    );

    margin: 0 auto;
}

.page {
    padding: 36px 0 72px;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    margin: 0 0 8px;

    font-size: clamp(
        28px,
        4vw,
        40px
    );

    line-height: 1.2;
}

.page-header p {
    margin: 0;

    color: var(--muted);
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.site-header {
    position: sticky;

    top: 0;

    z-index: 1000;

    background:
        rgba(255, 255, 255, 0.96);

    border-bottom:
        1px solid var(--border);

    backdrop-filter:
        blur(10px);
}

.navbar {
    position: relative;

    min-height: 68px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 24px;
}

.brand {
    color: var(--text);

    font-size: 19px;
    font-weight: 900;

    letter-spacing: -0.02em;

    text-decoration: none;

    white-space: nowrap;
}

.nav-links {
    display: flex;

    align-items: center;

    gap: 8px;
}

.nav-link {
    min-height: 40px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    padding: 8px 12px;

    color: var(--text-soft);

    font-size: 14px;
    font-weight: 700;

    text-decoration: none;

    border-radius: var(--radius-sm);
}

.nav-link:hover {
    background: var(--surface-soft);

    color: var(--text);
}

.nav-link.active {
    background: var(--blue-bg);

    color: var(--blue-text);
}


/* =========================================================
   HAMBURGER BUTTON
   ========================================================= */

.mobile-menu-button {
    display: none;

    width: 44px;
    height: 44px;

    padding: 0;

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-sm);

    background: #ffffff;

    color: var(--text);

    cursor: pointer;

    align-items: center;
    justify-content: center;

    font-size: 25px;
    line-height: 1;

    font-weight: 700;
}

.mobile-menu-button:hover {
    background: var(--surface-soft);
}


/* =========================================================
   CARDS
   ========================================================= */

.card {
    background: var(--surface);

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-lg);

    box-shadow:
        var(--shadow-sm);
}

.card-body {
    padding: 24px;
}

.card-title {
    margin: 0 0 6px;

    font-size: 20px;
    font-weight: 800;
}

.card-text {
    margin: 0;

    color: var(--muted);
}

.card-hover {
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.card-hover:hover {
    transform:
        translateY(-2px);

    box-shadow:
        var(--shadow-md);
}


/* =========================================================
   DASHBOARD
   ========================================================= */

.dashboard-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 20px;
}

.dashboard-grid .full-width {
    grid-column: 1 / -1;
}

.stat-card {
    padding: 24px;
}


/* =========================================================
   SECTIONS
   ========================================================= */

.section {
    margin-top: 30px;
}

.section-heading {
    display: flex;

    align-items: flex-end;
    justify-content: space-between;

    gap: 16px;

    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0;

    font-size: 22px;
}

.section-heading p {
    margin: 4px 0 0;

    color: var(--muted);
}


/* =========================================================
   BADGES
   ========================================================= */

.badge {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 6px 10px;

    border-radius:
        var(--radius-pill);

    font-size: 12px;
    font-weight: 800;

    line-height: 1;
}

.badge-free {
    background: var(--blue-bg);

    color: var(--blue-text);
}

.badge-paid,
.badge-completed {
    background: var(--green-bg);

    color: var(--green-text);
}

.badge-progress {
    background: var(--amber-bg);

    color: var(--amber-text);
}

.badge-expired,
.badge-danger {
    background: var(--red-bg);

    color: var(--red-text);
}

.badge-premium,
.badge-admin {
    background: var(--violet-bg);

    color: var(--violet-text);
}

.badge-muted,
.badge-draft {
    background: #f3f4f6;

    color: #4b5563;
}


/* =========================================================
   ACCESS CARD
   ========================================================= */

.access-card {
    padding: 22px;

    border-radius:
        var(--radius-md);
}

.access-card .label {
    margin-bottom: 6px;

    font-size: 13px;
    font-weight: 800;
}

.access-card .value {
    margin-bottom: 6px;

    font-size: 26px;
    font-weight: 900;
}

.access-card .description {
    color: inherit;

    opacity: 0.9;
}

.access-free {
    background: #f3f4f6;

    color: #374151;
}

.access-paid {
    background: var(--green-bg);

    color: var(--green-text);
}

.access-expired {
    background: var(--red-bg);

    color: var(--red-text);
}

.access-admin {
    background: var(--violet-bg);

    color: var(--violet-text);
}


/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
    min-height: 44px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 10px 16px;

    border:
        1px solid transparent;

    border-radius:
        var(--radius-sm);

    font-weight: 800;

    text-decoration: none;

    cursor: pointer;

    transition:
        opacity 0.15s ease,
        transform 0.15s ease,
        background 0.15s ease;
}

.btn:hover {
    opacity: 0.92;
}

.btn:active {
    transform:
        translateY(1px);
}

.btn-primary {
    background: var(--primary);

    color: #ffffff;
}

.btn-primary:hover {
    background:
        var(--primary-hover);
}

.btn-secondary {
    background: #ffffff;

    color: var(--text);

    border-color:
        var(--border-strong);
}

.btn-blue {
    background: #2563eb;

    color: #ffffff;
}

.btn-danger {
    background: #b91c1c;

    color: #ffffff;
}

.btn-disabled {
    background: #e5e7eb;

    color: #6b7280;

    cursor: not-allowed;

    pointer-events: none;
}

.btn-block {
    width: 100%;
}

.actions {
    display: flex;

    flex-wrap: wrap;

    gap: 10px;
}


/* =========================================================
   PROGRESS
   ========================================================= */

.progress-card {
    padding: 22px;
}

.progress-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-bottom: 12px;
}

.progress-title {
    font-weight: 800;
}

.progress-count {
    color: var(--muted);

    font-size: 14px;
    font-weight: 700;
}

.progress-track {
    width: 100%;
    height: 10px;

    background: #e5e7eb;

    border-radius:
        var(--radius-pill);

    overflow: hidden;
}

.progress-bar {
    height: 100%;

    background:
        var(--primary);

    border-radius:
        var(--radius-pill);

    transition:
        width 0.35s ease;
}

.progress-note {
    margin-top: 10px;

    color: var(--muted);

    font-size: 14px;
}


/* =========================================================
   TOPIC CARDS
   ========================================================= */

.topic-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 18px;
}

.topic-card {
    min-height: 260px;

    display: flex;

    flex-direction: column;

    padding: 24px;
}

.topic-card-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 14px;

    margin-bottom: 14px;
}

.topic-number {
    margin-bottom: 5px;

    color: var(--muted);

    font-size: 12px;
    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: 0.03em;
}

.topic-title {
    margin: 0;

    font-size: 22px;

    line-height: 1.3;
}

.topic-description {
    margin: 0 0 18px;

    color: var(--muted);

    line-height: 1.7;
}

.topic-card-footer {
    margin-top: auto;
}


/* =========================================================
   LESSON / READING PAGE
   ========================================================= */

.reading-container {
    width: min(
        calc(100% - 32px),
        860px
    );

    margin: 0 auto;
}

.lesson-card {
    padding: 34px;
}

.lesson-title {
    margin: 0 0 12px;

    font-size: clamp(
        30px,
        5vw,
        42px
    );

    line-height: 1.15;
}

.lesson-description {
    margin: 0;

    color: var(--text-soft);

    font-size: 18px;

    line-height: 1.8;
}

.lesson-section {
    margin-top: 20px;

    padding: 22px;

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-md);
}

.lesson-section h2 {
    margin: 0 0 10px;

    font-size: 19px;
}

.lesson-section p,
.lesson-content {
    margin: 0;

    color: var(--text-soft);

    line-height: 1.8;
}

.lesson-explanation {
    background:
        var(--blue-bg);

    border-color: #dbeafe;
}

.lesson-example {
    background: #f0fdf4;

    border-color: #dcfce7;
}

.lesson-mistake {
    background:
        var(--amber-bg);

    border-color: #ffedd5;
}

.lesson-action {
    background:
        var(--violet-bg);

    border-color: #ede9fe;
}

.lesson-tip {
    background: #fffbeb;

    border-color: #fef3c7;
}


/* =========================================================
   FORMS
   ========================================================= */

.form-card {
    max-width: 520px;

    margin: 0 auto;

    padding: 30px;
}

.form-group {
    margin-bottom: 17px;
}

.form-label {
    display: block;

    margin-bottom: 7px;

    font-size: 14px;
    font-weight: 800;
}

.form-control {
    width: 100%;

    min-height: 44px;

    padding: 11px 12px;

    border:
        1px solid var(--border-strong);

    border-radius:
        var(--radius-sm);

    background: #ffffff;

    color: var(--text);

    outline: none;
}

textarea.form-control {
    min-height: 120px;

    resize: vertical;
}

.form-control:focus {
    border-color: #64748b;

    box-shadow:
        0 0 0 3px
        rgba(100, 116, 139, 0.12);
}

.form-help {
    margin-top: 6px;

    color: var(--muted);

    font-size: 13px;
}


/* =========================================================
   ALERTS
   ========================================================= */

.alert {
    margin-bottom: 18px;

    padding: 14px 16px;

    border-radius:
        var(--radius-sm);

    font-weight: 700;
}

.alert-success {
    background:
        var(--green-bg);

    color:
        var(--green-text);
}

.alert-error {
    background:
        var(--red-bg);

    color:
        var(--red-text);
}

.alert-warning {
    background:
        var(--amber-bg);

    color:
        var(--amber-text);
}

.alert-info {
    background:
        var(--blue-bg);

    color:
        var(--blue-text);
}


/* =========================================================
   TABLES
   ========================================================= */

.table-card {
    overflow: hidden;
}

.table-wrap {
    width: 100%;

    overflow-x: auto;

    -webkit-overflow-scrolling:
        touch;
}

.table {
    width: 100%;

    border-collapse:
        collapse;
}

.table th,
.table td {
    padding: 14px 16px;

    text-align: left;

    vertical-align: middle;

    border-bottom:
        1px solid var(--border);

    white-space: nowrap;
}

.table th {
    background:
        var(--surface-soft);

    color:
        var(--text-soft);

    font-size: 13px;
    font-weight: 800;
}

.table tbody tr:hover {
    background: #fcfcfd;
}


/* =========================================================
   ADMIN
   ========================================================= */

.admin-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 18px;
}

.admin-card {
    padding: 22px;

    color: inherit;

    text-decoration: none;
}

.admin-card h3 {
    margin: 0 0 6px;
}

.admin-card p {
    margin: 0;

    color: var(--muted);
}


/* =========================================================
   AUTH
   ========================================================= */

.auth-page {
    min-height: 100vh;

    display: grid;

    place-items: center;

    padding: 28px 16px;
}

.auth-wrapper {
    width: 100%;

    max-width: 460px;
}

.auth-brand {
    margin-bottom: 22px;

    text-align: center;
}

.auth-brand a {
    font-size: 22px;
    font-weight: 900;

    text-decoration: none;
}

.auth-card {
    padding: 30px;

    background:
        var(--surface);

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-lg);

    box-shadow:
        var(--shadow-md);
}

.auth-title {
    margin: 0 0 8px;

    font-size: 28px;
}

.auth-subtitle {
    margin: 0 0 24px;

    color: var(--muted);
}

.auth-footer {
    margin-top: 20px;

    text-align: center;

    color: var(--muted);
}

.auth-footer a {
    color: var(--text);

    font-weight: 800;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
    padding: 38px 24px;

    color: var(--muted);

    text-align: center;
}

.empty-state h3 {
    margin: 0 0 8px;

    color: var(--text);
}


/* =========================================================
   UTILITIES
   ========================================================= */

.text-muted {
    color: var(--muted);
}

.text-center {
    text-align: center;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mt-4 {
    margin-top: 32px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.w-100 {
    width: 100%;
}




/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
    width: 100%;
    margin-top: 60px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-main {
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 36px;
    padding: 30px 0;
}

.footer-brand {
    max-width: 420px;
}

.footer-logo {
    display: inline-block;
    color: var(--text);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.footer-logo:hover {
    color: var(--primary-hover);
}

.footer-description {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.footer-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.footer-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 0;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.footer-nav a:hover {
    color: var(--text);
}

.footer-bottom {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .dashboard-grid,
    .topic-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .section-heading {
        align-items: flex-start;

        flex-direction: column;

        gap: 6px;
    }

    .table {
        min-width: 760px;
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    body {
        font-size: 15px;
    }




    /* Footer */

    .site-footer {
        margin-top: 42px;
    }

    .footer-main {
        min-height: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 22px;
        padding: 26px 0;
    }

    .footer-nav {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .footer-nav a {
        width: 100%;
        padding: 4px 0;
    }

    .footer-bottom {
        min-height: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 16px 0 20px;
    }


    /* -----------------------------------------------------
       NAVIGATION
       ----------------------------------------------------- */

    .navbar {
        min-height: 64px;

        padding: 9px 0;

        flex-direction: row;

        align-items: center;

        justify-content: space-between;

        gap: 12px;
    }

    .brand {
        font-size: 18px;
    }

    .mobile-menu-button {
        display: inline-flex;
    }

    .nav-links {
        display: none;

        position: absolute;

        top: calc(100% + 1px);

        left: 0;
        right: 0;

        width: 100%;

        padding: 8px;

        background: #ffffff;

        border:
            1px solid var(--border);

        border-top: 0;

        border-radius:
            0 0
            var(--radius-md)
            var(--radius-md);

        box-shadow:
            var(--shadow-md);
    }

    .nav-links.mobile-open {
        display: flex;

        flex-direction: column;

        align-items: stretch;

        gap: 3px;
    }

    .nav-link {
        width: 100%;

        min-height: 44px;

        justify-content: flex-start;

        padding: 10px 12px;

        font-size: 14px;

        white-space: normal;
    }


    /* -----------------------------------------------------
       PAGE
       ----------------------------------------------------- */

    .site-container {
        width:
            calc(100% - 24px);
    }

    .page {
        padding:
            22px 0 50px;
    }

    .page-header {
        margin-bottom: 22px;
    }

    .page-header h1 {
        font-size: 30px;
    }


    /* -----------------------------------------------------
       DASHBOARD
       ----------------------------------------------------- */

    .dashboard-grid {
        grid-template-columns: 1fr;

        gap: 16px;
    }

    .dashboard-grid .full-width {
        grid-column: auto;
    }


    /* -----------------------------------------------------
       CARDS
       ----------------------------------------------------- */

    .card-body,
    .stat-card,
    .progress-card {
        padding: 20px;
    }


    /* -----------------------------------------------------
       PROGRESS
       ----------------------------------------------------- */

    .progress-header {
        flex-direction: column;

        align-items: flex-start;

        gap: 5px;
    }


    /* -----------------------------------------------------
       TOPICS
       ----------------------------------------------------- */

    .topic-grid {
        grid-template-columns: 1fr;

        gap: 16px;
    }

    .topic-card {
        min-height: auto;

        padding: 20px;
    }

    .topic-card-header {
        flex-direction: column;

        align-items: flex-start;

        gap: 10px;
    }

    .topic-card-header .actions {
        flex-direction: row;

        align-items: center;

        flex-wrap: wrap;

        width: auto;
    }

    .topic-card-header .actions .badge {
        width: auto;
    }

    .topic-title {
        font-size: 21px;
    }

    .topic-description {
        font-size: 15px;
    }


    /* -----------------------------------------------------
       BUTTONS
       ----------------------------------------------------- */

    .actions {
        flex-direction: column;

        align-items: stretch;
    }

    .actions .btn {
        width: 100%;
    }


    /* -----------------------------------------------------
       READING
       ----------------------------------------------------- */

    .reading-container {
        width:
            calc(100% - 24px);
    }

    .lesson-card {
        padding: 22px;
    }

    .lesson-title {
        font-size: 31px;
    }

    .lesson-description {
        font-size: 16px;
    }

    .lesson-section {
        padding: 18px;
    }


    /* -----------------------------------------------------
       FORM
       ----------------------------------------------------- */

    .form-control {
        min-height: 46px;

        font-size: 16px;
    }


    /* -----------------------------------------------------
       AUTH
       ----------------------------------------------------- */

    .auth-page {
        min-height: 100dvh;

        display: flex;

        align-items: flex-start;
        justify-content: center;

        padding:
            22px 12px;
    }

    .auth-card {
        padding:
            24px 20px;
    }


    /* -----------------------------------------------------
       TABLE
       ----------------------------------------------------- */

    .table {
        min-width: 760px;
    }

    .table th,
    .table td {
        padding: 11px 12px;

        font-size: 13px;
    }

}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 520px) {

    .site-container,
    .reading-container {
        width:
            calc(100% - 20px);
    }

    .navbar {
        min-height: 60px;
    }

    .brand {
        font-size: 17px;
    }

    .mobile-menu-button {
        width: 42px;
        height: 42px;

        font-size: 23px;
    }

    .page {
        padding:
            18px 0 40px;
    }

    .page-header h1 {
        font-size: 27px;
    }

    .card-body,
    .stat-card,
    .progress-card,
    .topic-card {
        padding: 18px;
    }

    .topic-title {
        font-size: 20px;
    }

    .topic-description {
        font-size: 14px;
    }

    .lesson-card {
        padding: 18px;
    }

    .lesson-title {
        font-size: 27px;
    }

    .lesson-section {
        padding: 16px;
    }

    .btn {
        min-height: 44px;

        padding:
            10px 13px;

        font-size: 14px;
    }

    .badge {
        padding: 5px 8px;

        font-size: 11px;
    }

    .auth-card {
        padding:
            22px 18px;
    }

}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 380px) {

    .site-container,
    .reading-container {
        width:
            calc(100% - 16px);
    }

    .brand {
        font-size: 16px;
    }

    .page-header h1 {
        font-size: 25px;
    }

    .lesson-title {
        font-size: 25px;
    }

    .card-body,
    .topic-card,
    .progress-card {
        padding: 16px;
    }

    .lesson-card {
        padding: 16px;
    }

    .lesson-section {
        padding: 14px;
    }

}