:root {
    --bg: #080a0d;
    --panel: #0f1318;
    --panel-soft: #141920;
    --panel-hover: #191f27;

    --border: #252b33;
    --border-light: #343b45;

    --text: #f4efe8;
    --muted: #9098a3;
    --muted-dark: #626a74;

    --red: #b51f31;
    --red-bright: #d12a3f;
    --red-soft: rgba(181, 31, 49, 0.16);

    --green: #39c879;

    --radius: 14px;
    --radius-small: 9px;

    --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;

    background:
        radial-gradient(circle at 15% 15%, rgba(120, 0, 20, 0.10), transparent 34%),
        radial-gradient(circle at 85% 85%, rgba(100, 0, 18, 0.08), transparent 38%),
        var(--bg);

    color: var(--text);

    font-family: Arial, Helvetica, sans-serif;

    overflow-x: hidden;
}

/* =========================
   APP SHELL
========================= */

.app {
    min-height: 100vh;

    display: grid;
    grid-template-columns: 260px 1fr;
}

/* =========================
   SIDEBAR
========================= */

.sidebar {
    min-height: 100vh;

    background:
        linear-gradient(180deg, rgba(15, 18, 23, 0.98), rgba(8, 10, 13, 0.98));

    border-right: 1px solid var(--border);

    padding: 26px 18px;

    position: sticky;
    top: 0;

    height: 100vh;
}

.brand {
    padding: 4px 12px 28px;

    border-bottom: 1px solid var(--border);

    margin-bottom: 25px;
}

.brand-kicker {
    color: var(--red-bright);

    font-size: 11px;
    letter-spacing: 4px;
    font-weight: 700;

    text-transform: uppercase;

    margin-bottom: 9px;
}

.brand-title {
    font-family: Georgia, "Times New Roman", serif;

    font-size: 24px;
    letter-spacing: 1px;

    line-height: 1.05;
}

.brand-title span {
    color: var(--red-bright);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 13px;

    padding: 13px 14px;

    border: 1px solid transparent;
    border-radius: 9px;

    color: #c9ced5;

    text-decoration: none;

    font-size: 14px;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.nav-item:hover {
    background: var(--panel-hover);
    border-color: var(--border);

    color: white;

    transform: translateX(2px);
}

.nav-item.active {
    background:
        linear-gradient(
            90deg,
            rgba(181, 31, 49, 0.28),
            rgba(181, 31, 49, 0.09)
        );

    border-color: rgba(209, 42, 63, 0.55);

    color: white;
}

.nav-icon {
    width: 22px;
    text-align: center;
    font-size: 17px;
}

.sidebar-bottom {
    position: absolute;

    left: 18px;
    right: 18px;
    bottom: 24px;

    padding-top: 18px;

    border-top: 1px solid var(--border);
}

.admin-pill {
    display: flex;
    align-items: center;
    gap: 11px;

    padding: 12px 13px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: #10141a;
}

.admin-avatar {
    width: 34px;
    height: 34px;

    border-radius: 50%;

    display: grid;
    place-items: center;

    background: var(--red-soft);
    border: 1px solid rgba(209, 42, 63, 0.45);

    color: var(--red-bright);

    font-weight: 700;
}

.admin-name {
    font-size: 13px;
    font-weight: 700;
}

.admin-role {
    margin-top: 2px;

    font-size: 11px;

    color: var(--muted);
}

/* =========================
   MAIN AREA
========================= */

.main {
    min-width: 0;
}

.topbar {
    height: 76px;

    padding: 0 30px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid var(--border);

    background: rgba(9, 11, 14, 0.82);

    backdrop-filter: blur(12px);

    position: sticky;
    top: 0;

    z-index: 50;
}

.topbar-left h1 {
    font-family: Georgia, "Times New Roman", serif;

    font-size: 20px;
    font-weight: normal;

    letter-spacing: 1px;
}

.topbar-left p {
    margin-top: 4px;

    color: var(--muted);

    font-size: 12px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 8px 12px;

    border: 1px solid var(--border);
    border-radius: 50px;

    background: rgba(255,255,255,0.015);

    color: #cfd3d8;

    font-size: 11px;
    letter-spacing: 1.2px;
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--green);

    box-shadow: 0 0 12px rgba(57, 200, 121, 0.72);
}

/* =========================
   CONTENT
========================= */

.content {
    padding: 28px;
}

.workspace {
    display: grid;

    grid-template-columns:
        minmax(360px, 0.9fr)
        minmax(460px, 1.25fr);

    gap: 22px;
}

/* =========================
   PANELS
========================= */

.panel {
    background:
        linear-gradient(
            180deg,
            rgba(18, 22, 28, 0.96),
            rgba(12, 15, 19, 0.96)
        );

    border: 1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow);
}

.panel-header {
    padding: 21px 22px 16px;

    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-family: Georgia, "Times New Roman", serif;

    font-size: 20px;
    font-weight: normal;

    letter-spacing: 0.4px;
}

.panel-subtitle {
    margin-top: 5px;

    color: var(--muted);

    font-size: 12px;

    line-height: 1.5;
}

.panel-body {
    padding: 22px;
}

/* =========================
   MODE TABS
========================= */

.mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 6px;

    padding: 5px;

    background: #0b0e12;

    border: 1px solid var(--border);
    border-radius: 10px;

    margin-bottom: 19px;
}

.mode-tab {
    border: 0;

    border-radius: 7px;

    padding: 11px 8px;

    background: transparent;

    color: var(--muted);

    font-size: 12px;

    cursor: pointer;

    transition: all 0.18s ease;
}

.mode-tab:hover {
    color: white;
    background: #151a20;
}

.mode-tab.active {
    color: white;

    background:
        linear-gradient(
            180deg,
            rgba(181, 31, 49, 0.30),
            rgba(181, 31, 49, 0.16)
        );

    box-shadow: inset 0 0 0 1px rgba(209, 42, 63, 0.44);
}

/* =========================
   FORM ELEMENTS
========================= */

.field {
    margin-bottom: 19px;
}

.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 8px;

    font-size: 12px;
    color: #d6dae0;

    font-weight: 700;
}

.field-hint {
    color: var(--muted-dark);

    font-weight: normal;
    font-size: 11px;
}

textarea,
select,
input[type="text"] {
    width: 100%;

    border: 1px solid var(--border-light);
    border-radius: 9px;

    background: #0b0f14;

    color: var(--text);

    outline: none;

    font: inherit;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

textarea:focus,
select:focus,
input[type="text"]:focus {
    border-color: var(--red);

    box-shadow:
        0 0 0 3px rgba(181, 31, 49, 0.10);
}

textarea {
    resize: vertical;

    min-height: 185px;

    padding: 15px;

    line-height: 1.55;

    font-family: Georgia, "Times New Roman", serif;

    font-size: 15px;
}

select,
input[type="text"] {
    height: 45px;

    padding: 0 12px;
}

/* =========================
   CHOICE BUTTONS
========================= */

.choice-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);

    gap: 8px;
}

.choice-btn {
    min-height: 50px;

    padding: 8px;

    border-radius: 8px;

    border: 1px solid var(--border);

    background: #0c1015;

    color: #cfd3d8;

    font-size: 12px;

    cursor: pointer;

    transition: all 0.18s ease;
}

.choice-btn:hover {
    border-color: var(--border-light);

    color: white;

    background: #151a20;
}

.choice-btn.active {
    border-color: var(--red-bright);

    color: white;

    background: var(--red-soft);

    box-shadow:
        0 0 0 1px rgba(209, 42, 63, 0.13);
}

.choice-btn small {
    display: block;

    margin-top: 4px;

    color: var(--muted);

    font-size: 10px;
}

/* =========================
   TWO COLUMN FORM
========================= */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 12px;
}

/* =========================
   PROMPT TOOLS
========================= */

.prompt-tools {
    display: flex;
    gap: 8px;

    margin-top: 9px;

    flex-wrap: wrap;
}

.mini-btn {
    border: 1px solid var(--border);

    background: #11161c;

    color: #bbc1c8;

    border-radius: 7px;

    padding: 8px 10px;

    font-size: 11px;

    cursor: pointer;

    transition: all 0.18s ease;
}

.mini-btn:hover {
    background: #181e25;
    color: white;

    border-color: var(--border-light);
}

/* =========================
   GENERATE BUTTON
========================= */

.generate-btn {
    width: 100%;

    min-height: 58px;

    border: 1px solid #e13c50;
    border-radius: 9px;

    background:
        linear-gradient(
            180deg,
            #c62339,
            #9d1428
        );

    color: white;

    font-family: Georgia, "Times New Roman", serif;

    font-size: 16px;
    letter-spacing: 1px;

    cursor: pointer;

    box-shadow:
        0 14px 30px rgba(181, 31, 49, 0.18),
        inset 0 1px 0 rgba(255,255,255,0.15);

    transition:
        transform 0.18s ease,
        filter 0.18s ease;
}

.generate-btn:hover {
    filter: brightness(1.08);

    transform: translateY(-1px);
}

.generate-btn:active {
    transform: translateY(1px);
}

/* =========================
   RESULTS
========================= */

.results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 14px;

    margin-bottom: 18px;
}

.results-status {
    font-size: 12px;

    color: var(--muted);
}

.secondary-btn {
    border: 1px solid var(--border-light);

    background: #11161c;

    color: white;

    padding: 10px 13px;

    border-radius: 8px;

    font-size: 12px;

    cursor: pointer;

    transition: all 0.18s ease;
}

.secondary-btn:hover {
    border-color: var(--red);

    background: var(--red-soft);
}

/* =========================
   IMAGE RESULT CARDS
========================= */

.results-grid {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 14px;
}

.result-card {
    overflow: hidden;

    border-radius: 11px;

    border: 1px solid var(--border);

    background: #0a0d11;

    transition:
        transform 0.18s ease,
        border-color 0.18s ease;
}

.result-card:hover {
    transform: translateY(-2px);

    border-color: var(--border-light);
}

.result-image {
    aspect-ratio: 2 / 3;

    background:
        linear-gradient(145deg, #1a2027, #0c0f13);

    display: flex;
    align-items: center;
    justify-content: center;

    color: #4d5560;

    font-family: Georgia, "Times New Roman", serif;

    font-size: 13px;

    text-align: center;

    padding: 20px;

    position: relative;
}

.result-image img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}

.result-actions {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    border-top: 1px solid var(--border);
}

.result-action {
    padding: 10px 5px;

    border: 0;
    border-right: 1px solid var(--border);

    background: #0e1217;

    color: #aeb4bc;

    font-size: 10px;

    cursor: pointer;
}

.result-action:last-child {
    border-right: 0;
}

.result-action:hover {
    color: white;

    background: #171c22;
}

/* =========================
   EXPORT BAR
========================= */

.export-bar {
    margin-top: 17px;

    display: grid;
    grid-template-columns: repeat(4, 1fr);

    gap: 8px;
}

.export-btn {
    min-height: 44px;

    padding: 8px;

    border: 1px solid var(--border);

    border-radius: 8px;

    background: #0d1116;

    color: #c4c9d0;

    font-size: 10px;

    cursor: pointer;
}

.export-btn:hover {
    color: white;

    border-color: var(--red);

    background: var(--red-soft);
}

/* =========================
   GALLERY
========================= */

.gallery-panel {
    margin-top: 22px;
}

.gallery-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;
}

.gallery-controls {
    display: flex;
    gap: 8px;
}

.search-box {
    width: 230px !important;

    height: 40px !important;

    font-size: 12px !important;
}

.gallery-grid {
    display: grid;

    grid-template-columns: repeat(6, minmax(0, 1fr));

    gap: 13px;

    margin-top: 18px;
}

.gallery-card {
    min-width: 0;

    cursor: pointer;
}

.gallery-thumb {
    aspect-ratio: 2 / 3;

    border: 1px solid var(--border);
    border-radius: 8px;

    background:
        linear-gradient(145deg, #181d24, #0d1014);

    overflow: hidden;

    transition:
        transform 0.18s ease,
        border-color 0.18s ease;
}

.gallery-thumb:hover {
    transform: translateY(-2px);

    border-color: var(--red);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.gallery-name {
    margin-top: 8px;

    font-size: 11px;

    color: #d7dbe0;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-date {
    margin-top: 3px;

    font-size: 9px;

    color: var(--muted-dark);
}

/* =========================
   EMPTY STATE
========================= */

.empty-state {
    min-height: 510px;

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: center;

    text-align: center;

    padding: 40px;

    border: 1px dashed #303741;
    border-radius: 11px;

    background:
        radial-gradient(
            circle at center,
            rgba(181,31,49,0.06),
            transparent 45%
        );
}

.empty-icon {
    width: 62px;
    height: 62px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background: var(--red-soft);

    border: 1px solid rgba(209,42,63,0.30);

    color: var(--red-bright);

    font-size: 25px;

    margin-bottom: 18px;
}

.empty-title {
    font-family: Georgia, "Times New Roman", serif;

    font-size: 22px;
}

.empty-text {
    margin-top: 9px;

    max-width: 370px;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.6;
}

/* =========================
   BADGES
========================= */

.badge {
    display: inline-flex;
    align-items: center;

    padding: 5px 8px;

    border-radius: 50px;

    border: 1px solid var(--border);

    font-size: 9px;

    letter-spacing: 1px;

    color: var(--muted);
}

.badge.admin {
    color: #ff8c9b;

    border-color: rgba(209,42,63,0.35);

    background: rgba(181,31,49,0.10);
}

/* =========================
   MOBILE / TABLET
========================= */

@media (max-width: 1180px) {

    .workspace {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {

    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .topbar {
        padding: 0 18px;
    }

    .content {
        padding: 18px;
    }

    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {

    .content {
        padding: 12px;
    }

    .panel-body {
        padding: 15px;
    }

    .choice-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .export-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .gallery-controls {
        width: 100%;
    }

    .search-box {
        width: 100% !important;
    }
}