:root {
    --bg-app: #09090b;
    --bg-sidebar: #111113;
    --bg-input: #1e1e22;
    --border: #2e2e33;
    --primary: #8b5cf6;
    --gold: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    --text: #e4e4e7;
    --text-muted: #71717a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    outline: none;
}

body {
    background: var(--bg-app);
    color: var(--text);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 3px;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 70px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    z-index: 50;
    flex-shrink: 0;
}

.logo {
    font-weight: 900;
    color: var(--text);
    margin-bottom: 30px;
    font-size: 0.9rem;
    letter-spacing: -1px;
}

.nav-item {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 15px;
    transition: 0.2s;
    position: relative;
}

.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.tooltip {
    position: absolute;
    left: 50px;
    background: black;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    white-space: nowrap;
    font-size: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
    z-index: 100;
}

.nav-item:hover .tooltip {
    opacity: 1;
    left: 55px;
}

/* --- SETTINGS PANEL --- */
.settings {
    width: 400px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

/* Tabs (Grid) */
.grid-types {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.type-opt {
    background: var(--bg-input);
    padding: 10px 0;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    border: 1px solid transparent;
    transition: 0.2s;
}

.type-opt i {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    display: block;
}

.type-opt span {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
}

.type-opt:hover {
    border-color: var(--border);
}

.type-opt.active {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

.type-opt.active i,
.type-opt.active span {
    color: var(--primary);
}

/* Controls Area */
.controls-area {
    padding: 20px;
}

.group-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 25px 0 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-label:first-child {
    margin-top: 0;
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.col {
    flex: 1;
}

label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 6px;
    color: #d4d4d8;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: 0.2s;
}

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

/* --- PREMIUM CONTROLS --- */
/* Custom Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    flex-shrink: 0;
    margin: 0;
}

input[type="checkbox"]:hover {
    border-color: var(--primary);
}

input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
    content: '✔';
    position: absolute;
    color: white;
    font-size: 14px;
    font-weight: 800;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
    line-height: 1;
}

/* Custom Color Picker */
.color-picker-wrapper {
    position: relative;
    width: 100%;
    height: 40px;
}

.color-picker-wrapper input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.color-preview {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.2s;
}

.color-picker-wrapper:hover .color-preview {
    border-color: var(--primary);
}

/* Custom Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    border: 1px solid var(--border);
    padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    border: 3px solid var(--bg-sidebar);
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
    margin-top: -7px;
    transition: box-shadow 0.2s;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    /* FF needs smaller size with border */
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    border: 3px solid var(--bg-sidebar);
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
}

input[type="range"]:hover::-webkit-slider-thumb {
    box-shadow: 0 0 0 1px var(--primary);
}

input[type="range"]:hover::-moz-range-thumb {
    box-shadow: 0 0 0 1px var(--primary);
}

/* Visual Selectors */
.vis-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.vis-item {
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.vis-item.active {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

/* CSS Shapes */
.s-box {
    width: 14px;
    height: 14px;
    background: #a1a1aa;
}

.s-dot {
    width: 14px;
    height: 14px;
    background: #a1a1aa;
    border-radius: 50%;
}

.s-rnd {
    width: 14px;
    height: 14px;
    background: #a1a1aa;
    border-radius: 4px;
}

.s-ex-rnd {
    width: 14px;
    height: 14px;
    background: #a1a1aa;
    border-radius: 6px;
}

.s-classy {
    width: 14px;
    height: 14px;
    background: #a1a1aa;
    border-radius: 6px 0;
}

.s-classy-rnd {
    width: 14px;
    height: 14px;
    background: #a1a1aa;
    border-radius: 8px 0;
}

.s-eye-sq {
    width: 18px;
    height: 18px;
    border: 2px solid #a1a1aa;
}

.s-eye-rnd {
    width: 18px;
    height: 18px;
    border: 2px solid #a1a1aa;
    border-radius: 50%;
}

/* Lock System */
.locked-area {
    position: relative;
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(1);
    transition: 0.3s;
}

.lock-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--gold);
    color: black;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    z-index: 10;
    cursor: pointer;
}

body.is-pro .locked-area {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

body.is-pro .lock-badge,
body.is-pro .badge-pro {
    display: none !important;
}

.badge-pro {
    background: var(--gold);
    color: black;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 800;
    margin-left: 5px;
    cursor: pointer;
}

.fake-badge-pro {
    background: var(--gold);
    color: black;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 800;
    margin-left: 5px;
}

/* --- STAGE --- */
.stage {
    flex: 1;
    background-color: #050505;
    background-image: radial-gradient(#1f1f22 1px, transparent 1px);
    background-size: 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card {
    background: white;
    padding: 0;
    border-radius: 4px;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.8);
    max-width: 500px;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
    overflow: visible;
}

#qr-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

#qr-wrapper svg {
    width: 100%;
    height: 100%;
}

#bar-wrapper {
    padding: 20px;
    background: white;
    width: 100%;
    max-width: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#bar-wrapper svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.actions {
    position: absolute;
    bottom: 30px;
    display: flex;
    gap: 10px;
    background: var(--bg-sidebar);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.btn {
    padding: 10px 20px;
    min-height: 42px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    font-size: 0.9rem;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-p {
    background: var(--primary);
}

.btn-p:hover {
    background: #7c3aed;
}

.btn-s {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-s:hover {
    background: #2e2e33;
    border-color: #4e4e55;
}

/* MODAL */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal {
    width: 450px;
    background: var(--bg-sidebar);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--gold);
    text-align: center;
    position: relative;
}

.key-input {
    text-align: center;
    font-family: monospace;
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-color: var(--gold);
    margin-bottom: 10px;
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

.hidden-file-input {
    display: none;
}

/* Icon Picker Styles */
.icon-item {
    height: 60px;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: .2s;
}

.icon-item:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ADMIN PANEL STYLES */
.admin-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    border-radius: 14px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 20px;
    text-align: left;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #334155;
    padding-bottom: 10px;
}

.console {
    background: #020617;
    border: 1px solid #1e293b;
    color: #10b981;
    font-family: monospace;
    padding: 10px;
    border-radius: 6px;
    height: 150px;
    overflow-y: auto;
    font-size: 0.75rem;
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

/* --- ADDED FEATURES --- */

/* Close Button */
.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

/* History Items */
.history-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(2px);
}

.h-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 0.9rem;
}

.h-info {
    flex: 1;
}

.h-type {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.h-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.h-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.h-btn:hover {
    color: var(--primary);
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {

    /* Tablet */
    .settings {
        width: 300px;
        flex-shrink: 0;
        /* prevent shrinking */
    }

    .grid-types {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {

    /* Mobile */
    body {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: 65px;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--border);
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 100;
        background: var(--bg-sidebar);
    }

    .sidebar .logo,
    .sidebar div[style="flex:1"] {
        display: none;
    }

    .nav-item {
        margin-bottom: 0;
        flex: 1;
        height: 100%;
        border-radius: 0;
    }

    .tooltip {
        display: none;
    }

    .settings {
        width: 100%;
        order: 2;
        /* After stage */
        border-right: none;
        height: auto;
        overflow-y: visible;
        flex-shrink: 0;
    }

    .grid-types {
        /* Back to 4 on full width */
        grid-template-columns: repeat(4, 1fr);
    }

    .stage {
        order: 1;
        /* Before settings */
        flex-grow: 1;
        padding: 20px 0;
        /* Bottom padding for actions + nav bar */
        padding-bottom: 140px;
    }

    .card {
        max-width: 90vw;
        margin: 0 auto;
    }

    .actions {
        position: relative;
        bottom: auto;
        margin-top: 30px;
    }

    .modal {
        width: 90vw;
    }
}