/* ==========================================================================
   ProQR Studio - Design System & Modern Glassmorphism Styling
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-dark: #090d16;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(10, 15, 26, 0.7);
    --border-input: rgba(255, 255, 255, 0.12);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    
    --accent: #06b6d4;
    --accent-hover: #0891b2;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-sub: #cbd5e1;

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Typography & Spacing */
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Settings */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Ambient Glow */
.background-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
}
.glow-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
}
.glow-2 {
    bottom: -10%;
    right: -10%;
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
}

/* Layout Container */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.brand-text h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.brand-text h1 span {
    background: linear-gradient(135deg, #a5b4fc, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.header-badges {
    display: flex;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* Main Grid Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 440px;
    gap: 24px;
    flex: 1;
}

/* Glassmorphism Panel */
.panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Tabs Section */
.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 12px;
    display: block;
}

.type-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.tab-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    padding: 12px 10px;
    color: var(--text-sub);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.tab-icon {
    font-size: 1.3rem;
}

.tab-title {
    font-size: 0.8rem;
    font-weight: 600;
}

/* Forms */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-header-title {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--bg-card-border);
}

.form-header-title h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.form-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-sub);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.input-field, .input-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.input-field:focus, .input-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(15, 23, 42, 0.9);
}

.input-lg {
    padding: 14px 16px;
    font-size: 1rem;
}

.textarea-sm {
    min-height: 70px;
    resize: vertical;
}

.textarea-lg {
    min-height: 140px;
    resize: vertical;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-checkbox label {
    font-size: 0.88rem;
    color: var(--text-sub);
    cursor: pointer;
}

/* Dynamic Field Adders (vCard) */
.dynamic-section {
    background: rgba(10, 15, 26, 0.4);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 16px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.section-title-row label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
}

.btn-add-item {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add-item:hover {
    background: var(--primary);
    color: #ffffff;
}

.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dynamic-item-row {
    display: grid;
    grid-template-columns: 130px 1fr 38px;
    gap: 8px;
    align-items: center;
}

.btn-remove-item {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-remove-item:hover:not(:disabled) {
    background: var(--danger);
    color: #ffffff;
}

.btn-remove-item:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Card Style for Address */
.dynamic-item-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
}

.card-header-sm {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-remove-card {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 0.78rem;
    cursor: pointer;
    font-weight: 600;
}

.btn-remove-card:hover:not(:disabled) {
    text-decoration: underline;
}

.margin-top-sm { margin-top: 10px; }
.margin-top-md { margin-top: 16px; }

/* Right Preview Panel */
.preview-panel {
    display: flex;
    flex-direction: column;
}

.preview-sticky {
    position: sticky;
    top: 24px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.preview-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Readability Badges */
.readability-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-ideal {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

/* QR Stage & Canvas */
.qr-stage {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.qr-canvas-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.qr-canvas-card:hover {
    transform: scale(1.02);
}

#qr-canvas {
    display: block;
    max-width: 250px;
    max-height: 250px;
    width: 100%;
    height: auto;
}

/* Density Info Bar */
.density-info {
    margin-bottom: 20px;
}

.density-bar-wrapper {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.density-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--accent));
    transition: width 0.3s ease;
}

.density-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Customization Box */
.customization-box {
    background: rgba(10, 15, 26, 0.5);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.custom-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
}

.custom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.custom-group label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
}

.color-picker-wrapper input[type="color"] {
    border: none;
    background: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.color-val-text {
    font-size: 0.82rem;
    font-family: monospace;
    color: var(--text-sub);
}

.select-sm {
    padding: 6px 10px;
    font-size: 0.82rem;
}

.logo-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-upload-wrapper input[type="file"] {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    width: 100%;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    cursor: pointer;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 24px 0 10px;
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .preview-sticky {
        position: static;
    }
}

@media (max-width: 640px) {
    .type-tabs {
        grid-template-columns: repeat(3, 1fr);
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .dynamic-item-row {
        grid-template-columns: 100px 1fr 34px;
    }
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
