:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --dark-surface: #1e293b;
    --dark-card: #1e293b;
    --border-color: #334155;
    --text-muted: #94a3b8;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #0b0f19 0%, #111827 50%, #1e1b4b 100%);
    color: #f8fafc;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Glass Header */
.app-navbar {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Generator Split Layout */
.generator-wrapper {
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px 16px;
}

.card-glass {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.editor-sidebar {
    position: sticky;
    top: 75px;
    height: fit-content;
    max-height: calc(100vh - 95px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #475569 transparent;
}

.editor-sidebar::-webkit-scrollbar {
    width: 6px;
}
.editor-sidebar::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

/* Canvas Stage */
.canvas-stage-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    padding: 18px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-md);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    min-height: 480px;
    width: 100%;
}

.canvas-viewport {
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    overflow: auto;
    background: #000;
    max-width: 100%;
    max-height: calc(100vh - 160px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    scrollbar-width: thin;
    scrollbar-color: #475569 transparent;
}

.canvas-viewport::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.canvas-viewport::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

#posterCanvas {
    display: block;
    cursor: default;
    background: #0f172a;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    max-width: 100%;
    height: auto;
}

#posterCanvas.dragging {
    cursor: grab;
}

#posterCanvas.dragging:active {
    cursor: grabbing;
}

/* Locked Brand Guarantee Banner */
.locked-brand-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid rgba(168, 85, 247, 0.35);
    backdrop-filter: blur(8px);
}

/* Mobile Segmented Nav Pills */
.mobile-nav-pill-wrapper .btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Mobile Sticky Action Bar */
.mobile-sticky-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.6);
}

/* Canvas Floating Toolbar */
.canvas-floating-bar {
    position: absolute;
    bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.floating-btn {
    background: transparent;
    border: none;
    color: #e2e8f0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.floating-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Form Groups & Controls */
.form-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: #cbd5e1;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-label small {
    font-weight: normal;
    color: var(--text-muted);
}

.form-control, .form-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid #334155;
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    background: rgba(15, 23, 42, 0.8);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    color: #fff;
}

.form-control::placeholder {
    color: #64748b;
}

/* Photo Upload Box */
.photo-upload-zone {
    border: 2px dashed #475569;
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    background: rgba(15, 23, 42, 0.4);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.photo-upload-zone:hover, .photo-upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.photo-thumb-preview {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--primary);
}

/* Shape Badges */
.badge-shape {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
    text-transform: capitalize;
}

/* Custom Zoom & Pan slider widget */
.image-adjust-widget {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 10px;
}

/* Buttons */
.btn-primary-gradient {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
    color: #fff;
}

.btn-whatsapp {
    background: #25D366;
    color: #fff;
    font-weight: 600;
    border: none;
}
.btn-whatsapp:hover {
    background: #1eb956;
    color: #fff;
}

/* Success Modal Overlay */
.download-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.download-modal-overlay.show {
    display: flex;
}

.modal-content-custom {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    0% { transform: scale(0.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.poster-preview-img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background: #090d16;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

/* Toast */
.toast-notice {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #1e293b;
    border-left: 4px solid var(--primary);
    color: #fff;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notice.show {
    transform: translateY(0);
    opacity: 1;
}

/* Spinner Loader */
.spinner-pulse {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 991px) {
    .generator-wrapper {
        padding: 12px 10px 85px 10px;
    }
    
    .editor-sidebar {
        max-height: none;
    }

    .canvas-stage-wrapper {
        min-height: auto;
        padding: 12px 6px;
    }

    .canvas-floating-bar {
        bottom: 12px;
        gap: 8px;
        padding: 6px 14px;
    }

    .floating-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    /* Prevent mobile browser (iOS Safari) from auto-zooming into inputs */
    .form-control, .form-select {
        font-size: 16px !important;
    }

    .photo-upload-zone {
        padding: 15px 10px;
    }
}
