:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-blur: blur(12px);
    --accent: #10b981;
    --radius: 12px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 320px;
    height: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow-y: auto;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
}

header {
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.icon-primary {
    color: var(--primary);
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Controls */
.controls {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.section-header i {
    width: 16px;
    height: 16px;
}

.upload-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
}

.file-input-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
    pointer-events: auto !important;
}

.upload-btn *:not(.file-input-overlay) {
    pointer-events: none;
}

.upload-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-btn i {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--accent);
}

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

.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-field.full-width {
    grid-column: span 2;
}

.input-field label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    font-weight: 600;
}

.input-field input {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    width: 100%;
}

.input-field input:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
}

/* Aspect Ratio Toggle */
.toggle-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-main);
}

.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(14px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Info Badge */
.info-badge {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--accent);
}

.info-badge i {
    width: 16px;
    height: 16px;
}

.info-badge strong {
    color: white;
    font-weight: 700;
}

#calculated-size-box {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#calculated-size-box strong {
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

.custom-select {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.custom-select:focus {
    border-color: var(--primary);
}

.custom-select option {
    background: var(--bg-dark);
}

.orientation-selector {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.orientation-option {
    flex: 1;
    cursor: pointer;
    position: relative;
}

.orientation-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.option-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    color: var(--text-dim);
    text-align: center;
}

.option-box i {
    width: 24px;
    height: 24px;
}

.option-box span {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.orientation-option input:checked + .option-box {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.85rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

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

.primary-btn:active {
    transform: scale(0.98);
}

/* Preview Area */
.preview-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    overflow: auto;
}

.canvas-wrapper {
    background: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.canvas-wrapper.glass {
    border: none; /* Reset glass border for paper effect */
}

#preview-canvas {
    display: block;
    max-width: 100%;
    max-height: 80vh;
}

.canvas-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
    color: var(--text-dim);
}

.paper-size-label {
    font-size: 0.85rem;
    font-weight: 500;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.zoom-controls button {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
}

.zoom-controls button:hover {
    color: var(--text-main);
}

footer {
    margin-top: auto;
    padding-top: 2rem;
}

footer p {
    font-size: 0.75rem;
    color: #475569;
}

/* Notifications */
#notification-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    color: var(--text-main);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
    }

    .app-container {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .preview-area {
        padding: 1.5rem;
        min-height: 50vh;
        overflow: visible;
    }

    .canvas-wrapper {
        margin-bottom: 2rem;
        max-width: 100%;
        width: auto !important;
        height: auto !important;
    }

    #preview-canvas {
        max-height: 50vh;
        width: auto !important;
    }

    .canvas-controls {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .zoom-controls {
        width: 100%;
        justify-content: center;
    }

    .settings-section {
        padding-bottom: 1rem;
    }

    header {
        margin-bottom: 1.5rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    #notification-container {
        position: fixed;
        bottom: 2rem;
        right: 2rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

