/* ==========================================================================
   QR Kode Generator Studio - Modern Design System & Styles
   ========================================================================== */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Light Theme */
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --preview-bg: #f1f5f9;
}

[data-theme="dark"] {
    --bg-main: #0b0f19;
    --bg-surface: #131b2e;
    --bg-surface-hover: #1e293b;
    --bg-card: rgba(19, 27, 46, 0.85);
    --border-color: #243048;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    --preview-bg: #1e293b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
    background-image: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.05) 0%, transparent 40%);
}

/* App Header */
.app-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-main) 60%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle-btn {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.55rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Main Layout */
.main-container {
    max-width: 1400px;
    margin: 1.75rem auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1.25fr 0.95fr;
    gap: 2rem;
    flex: 1;
    width: 100%;
}

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }
}

/* Type Selector Buttons (Categories) */
.category-section {
    margin-bottom: 1.5rem;
}

.category-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.85rem;
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}

.type-btn {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 0.9rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.type-btn .icon {
    font-size: 1.55rem;
    transition: transform 0.2s ease;
}

.type-btn:hover {
    border-color: var(--primary);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.type-btn:hover .icon {
    transform: scale(1.12);
}

.type-btn.active {
    background: linear-gradient(145deg, var(--primary-light), var(--bg-surface));
    border-color: var(--primary);
    color: var(--primary-hover);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25), var(--shadow-md);
}

[data-theme="dark"] .type-btn.active {
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.25), var(--bg-surface));
    color: #a5b4fc;
}

.type-btn.badge-special::after {
    content: 'POPULÆR';
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    color: white;
    font-size: 0.58rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

/* Card Containers */
.editor-card, .preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Form Controls */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: var(--text-main);
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.input-control, .select-control, textarea.input-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    outline: none;
}

.input-control:focus, .select-control:focus, textarea.input-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: var(--bg-surface);
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-addon {
    background: var(--bg-surface-hover);
    border: 1.5px solid var(--border-color);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    border-radius: 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Social Hub Special Form */
.social-hub-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
    border: 1.5px dashed var(--primary);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.social-input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.social-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.social-fb { background: #1877f2; }
.social-ig { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.social-tt { background: #000000; }
.social-yt { background: #ff0000; }
.social-web { background: #0284c7; }
.social-mp { background: #5a78ff; }

/* Disabled state for social fields */
.social-field-group {
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.social-field-group.is-disabled {
    opacity: 0.35;
    filter: grayscale(0.9);
    pointer-events: none;
}

.social-field-group.is-disabled .input-control {
    background: var(--bg-surface-hover);
    border-color: var(--border-color);
    cursor: not-allowed;
    color: var(--text-muted);
}

.social-clear-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    cursor: pointer;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: none;
    transition: all 0.2s ease;
}

.social-clear-btn:hover {
    background: #ef4444;
    color: white;
}

.social-status-banner {
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--bg-surface-hover);
    border: 1.5px solid var(--border-color);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
}

.social-status-banner.is-active {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #059669;
}

[data-theme="dark"] .social-status-banner.is-active {
    color: #34d399;
}

/* Preset Quick Color Themes */
.preset-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.preset-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.preset-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    padding: 0.45rem 0.85rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.preset-btn:hover {
    transform: scale(1.04);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary);
}

.preset-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

/* Accordion for advanced styling */
.accordion {
    margin-top: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
}

.accordion-header {
    background: var(--bg-surface-hover);
    padding: 0.85rem 1.25rem;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.accordion-body {
    padding: 1.25rem;
    background: var(--bg-surface);
    display: none;
}

.accordion-body.open {
    display: block;
}

/* Color Picker Row */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.6rem;
    border-radius: 10px;
}

.color-input-wrapper input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 8px;
}

/* Right Side: Preview Card */
.preview-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: sticky;
    top: 6rem;
    height: fit-content;
}

.qr-canvas-container {
    background: var(--preview-bg);
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    padding: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
    min-height: 320px;
    width: 100%;
    max-width: 380px;
    transition: all 0.3s ease;
}

.qr-canvas-container canvas {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* Action Buttons */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    width: 100%;
    margin-bottom: 1rem;
}

.btn {
    padding: 0.85rem 1.25rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-secondary {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--text-muted);
}

.btn-full {
    grid-column: 1 / -1;
}

/* Toast Notification */
.toast-msg {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #0f172a;
    color: #ffffff;
    padding: 0.85rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Scanner Overlay / Tab */
.scanner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.drop-zone {
    border: 2px dashed var(--primary);
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--bg-surface-hover);
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.dragover {
    background: var(--primary-light);
    border-color: var(--primary-hover);
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    .app-header, .editor-card, .category-section, .action-grid, .preset-section, .theme-toggle-btn {
        display: none !important;
    }
    .main-container {
        display: block !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .preview-card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .qr-canvas-container {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }
}
