:root {
    /* Formal Feminine Palette */
    --c-bg: #F9F9F4;
    /* Cream White */
    --c-sidebar: #FFFFFF;
    --c-primary: #B76E79;
    /* Rose Gold */
    --c-primary-dark: #8E4A54;
    --c-accent: #D4AF37;
    /* Muted Gold */
    --c-navy: #2C3E50;
    /* Elegant Navy for text */
    --c-text-muted: #7F8C8D;

    --font-head: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;

    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--c-bg);
    color: var(--c-navy);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    /* App feel */
}

/* --- Layout --- */
.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* --- Sidebar --- */
.sidebar-nav {
    width: 260px;
    background: var(--c-sidebar);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.02);
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 50px;
    color: var(--c-primary);
}

.brand h1 {
    font-family: var(--font-head);
    font-size: 1.8rem;
    font-weight: 700;
}

.brand-icon {
    font-size: 2rem;
}

.nav-item {
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    padding: 15px 20px;
    border-radius: var(--radius);
    color: var(--c-text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: 0.3s;
    margin-bottom: 10px;
    font-family: var(--font-body);
}

.nav-item:hover,
.nav-item.active {
    background: #FFF0F3;
    /* Very light pink */
    color: var(--c-primary);
    font-weight: 700;
}

.sidebar-footer {
    margin-top: auto;
    text-align: center;
    font-size: 0.85rem;
    color: var(--c-text-muted);
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.sidebar-footer p {
    font-weight: 600;
    letter-spacing: 1px;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.view {
    display: none;
    height: 100%;
    animation: fadeScale 0.4s ease;
}

.view.active {
    display: block;
}

@keyframes fadeScale {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Workspace Layout --- */
.workspace {
    display: flex;
    height: 100%;
}

.editor-panel {
    flex: 2;
    padding: 50px;
    overflow-y: auto;
}

.preview-panel {
    flex: 1;
    background: #FFFFFF;
    border-left: 1px solid #EEE;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
}

/* --- Editor --- */
.section-header h2 {
    font-family: var(--font-head);
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--c-navy);
}

.section-header p {
    color: var(--c-text-muted);
    margin-bottom: 30px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid #EEE;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 1rem;
    color: var(--c-text-muted);
    cursor: pointer;
    position: relative;
    font-weight: 600;
}

.tab-btn.active {
    color: var(--c-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--c-primary);
}

/* Inputs */
.input-pane {
    display: none;
    margin-bottom: 30px;
}

.input-pane.active {
    display: block;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

textarea,
input[type="url"],
input[type="text"] {
    width: 100%;
    padding: 15px;
    border: 1px solid #DDD;
    border-radius: var(--radius);
    background: #FFF;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: 0.3s;
}

textarea {
    height: 120px;
    resize: none;
}

textarea:focus,
input:focus {
    border-color: var(--c-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(183, 110, 121, 0.1);
}

/* File Drop */
.file-drop-zone {
    border: 2px dashed #DDD;
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    color: var(--c-text-muted);
    cursor: pointer;
    position: relative;
    transition: 0.3s;
}

.file-drop-zone:hover {
    border-color: var(--c-primary);
    background: #FFFAFA;
}

.file-drop-zone .material-icons-round {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--c-primary);
}

#file-upload {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-status {
    margin-top: 10px;
    font-weight: 600;
    color: var(--c-navy);
}

.btn-primary {
    background: var(--c-primary);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(183, 110, 121, 0.3);
    transition: 0.3s;
}

.btn-primary:hover {
    background: var(--c-primary-dark);
    transform: translateY(-2px);
}

.btn-large {
    width: 100%;
}

/* --- Preview & Frames --- */
.preview-panel h3 {
    font-family: var(--font-head);
    margin-bottom: 20px;
}

.qr-canvas-container {
    width: 280px;
    height: 320px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
}

.frames-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
}

.frame-option {
    background: #F9F9F4;
    padding: 15px;
    text-align: center;
    border: 1px solid #EEE;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
}

.frame-option:hover {
    border-color: var(--c-primary);
    background: white;
}

/* --- Frame Styles (CSS) --- */
.qr-frame {
    background: white;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: 0.3s;
}

.frame-label {
    margin-top: 10px;
    font-weight: 700;
    font-family: var(--font-head);
    font-size: 0.8rem;
}

/* 1. Clean */
.frame-clean {
    padding: 0;
}

.frame-clean .frame-label {
    display: none;
}

/* 2. Classic */
.frame-classic {
    border: 1px solid var(--c-navy);
    padding: 20px;
    box-shadow: 5px 5px 0 rgba(44, 62, 80, 0.1);
}

/* 3. Rounded */
.frame-rounded {
    border-radius: 20px;
    border: 4px solid var(--c-primary);
    background: #FFF0F3;
}

.frame-rounded #qr-code {
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid white;
}

.frame-rounded .frame-label {
    color: var(--c-primary);
}

/* 4. Blob/Artistic */
.frame-blob {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.frame-blob .frame-label {
    display: none;
}

/* 5. Ornament */
.frame-ornament {
    border: 2px double var(--c-accent);
    padding: 15px;
    position: relative;
    outline: 1px solid var(--c-accent);
    outline-offset: 5px;
}

.frame-ornament::before {
    content: '⚜';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 0 5px;
    color: var(--c-accent);
    font-size: 1.2rem;
}

/* 6. Badge */
.frame-badge {
    background: var(--c-navy);
    border-radius: 10px;
    padding: 20px 20px 40px 20px;
    clip-path: polygon(0% 0%, 100% 0%, 100% 85%, 50% 100%, 0% 85%);
}

.frame-badge #qr-code {
    border: 2px solid white;
}

.frame-badge .frame-label {
    color: var(--c-accent);
    margin-top: 5px;
}


/* --- Scan View --- */
.scan-workspace {
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.scan-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-outline {
    background: white;
    border: 1px solid #DDD;
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--c-navy);
}

.btn-outline:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
}

.scanner-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.scanner-border {
    width: 400px;
    height: 300px;
    border-radius: 20px;
    border: 8px solid var(--c-sidebar);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

#reader {
    width: 100%;
    height: 100%;
}

.result-card {
    background: white;
    padding: 20px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    position: absolute;
    bottom: 50px;
    border: 1px solid #EEE;
}

.success-icon {
    color: #2ecc71;
    font-size: 2rem;
}

.btn-icon-only {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--c-navy);
}

.hidden {
    display: none;
}