:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-ring: rgba(37, 99, 235, 0.2);
    --surface: #ffffff;
    --background: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-focus: #3b82f6;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --card-shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Navbar */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.25rem;
}

.brand-badge {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.brand-logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    display: block;
    flex-shrink: 0;
}

.nav-menu {
    display: flex;
    gap: 1rem;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background-color: var(--primary-light);
}

/* Language Switcher */
.lang-switcher {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 0.2rem 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 0.15rem;
}

.lang-btn {
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    transition: all 0.15s ease-in-out;
    display: inline-block;
}

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

.lang-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.lang-sep {
    color: #cbd5e1;
    font-size: 0.75rem;
    user-select: none;
}

/* Main Container */
.main-content {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Advertisement Layout & Spaces */
.page-ad-wrapper {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 0 0.5rem;
    align-items: flex-start;
    flex: 1;
}

.main-content-column {
    flex: 1;
    max-width: 1160px;
    width: 100%;
    min-width: 0;
}

.ad-side-column {
    display: none;
    width: 160px;
    flex-shrink: 0;
    position: sticky;
    top: 5rem;
    margin-top: 1rem;
}

@media (min-width: 1400px) {
    .ad-side-column {
        display: block;
    }
}

.ad-space-top {
    width: 100%;
    margin: 0.5rem 0 1.5rem 0;
}

.ad-space-bottom {
    width: 100%;
    margin: 2rem 0 1rem 0;
}

.ad-banner-box {
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.75rem;
    color: var(--text-muted);
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.ad-banner-box:hover {
    border-color: #94a3b8;
    background-color: #f1f5f9;
}

.ad-banner-top {
    min-height: 90px;
    width: 100%;
}

.ad-banner-bottom {
    min-height: 100px;
    width: 100%;
}

.ad-banner-skyscraper {
    min-height: 600px;
    width: 160px;
}

.ad-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    background: #e2e8f0;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.4rem;
}

.ad-placeholder-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.ad-size-hint {
    font-size: 0.725rem;
    color: #94a3b8;
    margin-top: 0.2rem;
}

/* Page Header */
.page-title-section {
    margin-bottom: 1.75rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #0f172a;
}

.page-subtitle {
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 1rem;
}

/* Privacy Notice Badge under Page Title */
.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.4rem 0.9rem;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.privacy-badge svg {
    color: #16a34a;
    flex-shrink: 0;
}

/* Two-column layout */
.generator-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .generator-grid {
        grid-template-columns: 1.25fr 0.95fr;
        align-items: start;
    }
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

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

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    background-color: #fcfdfe;
    overflow-x: auto;
}

.tab-btn {
    padding: 0.85rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.925rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: all 0.2s;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background-color: #ffffff;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

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

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

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .form-row.two-cols {
        grid-template-columns: 1fr 1fr;
    }
    .form-row.three-cols {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.4rem;
    color: #334155;
}

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

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.65rem 0.875rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    color: var(--text-main);
    transition: all 0.2s;
    outline: none;
}

.form-textarea {
    resize: vertical;
    min-height: 90px;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

/* Accordion / Collapsible Section */
.custom-section {
    border-top: 1px solid var(--border);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

.section-subtitle {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1e293b;
}

/* Color Pickers */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-picker-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 44px;
    height: 40px;
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 2px;
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-input::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-hex-text {
    flex: 1;
    font-family: monospace;
    text-transform: uppercase;
}

.color-presets {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.color-preset-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px #cbd5e1;
    transition: transform 0.15s;
}

.color-preset-dot:hover {
    transform: scale(1.15);
}

/* File Upload Box */
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    background-color: #f8fafc;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

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

.upload-icon {
    font-size: 1.75rem;
    margin-bottom: 0.35rem;
    color: var(--primary);
}

.upload-text {
    font-weight: 600;
    font-size: 0.9rem;
    color: #334155;
}

.upload-subtext {
    font-size: 0.775rem;
    color: var(--text-muted);
}

.file-hidden-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.logo-preview-box {
    display: none;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    align-items: center;
    justify-content: space-between;
}

.logo-preview-box.active {
    display: flex;
}

.logo-thumb {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: #ffffff;
    border: 1px solid var(--border);
}

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

/* Logo Customization Options */
.logo-options-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}

.radio-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.radio-pill-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.radio-pill-label:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.radio-pill-label input[type="radio"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.radio-pill-label.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.825rem;
}

/* QR Preview Panel */
.preview-card {
    position: sticky;
    top: 5rem;
}

.qr-display-container {
    background: radial-gradient(circle, #f8fafc 0%, #edf2f7 100%);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    border: 1px dashed #cbd5e1;
    position: relative;
}

.qr-image-wrapper {
    background: #ffffff;
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow-lg);
    display: inline-block;
    transition: transform 0.2s ease;
}

.qr-image-wrapper:hover {
    transform: scale(1.02);
}

.qr-img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-md);
}

.qr-meta-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1.25rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #334155;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.preview-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
    width: 100%;
}

/* History Cards */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.history-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.history-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-lg);
}

.history-qr-thumb {
    width: 100%;
    aspect-ratio: 1;
    background: #f8fafc;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #f1f5f9;
}

.history-qr-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.history-content-snippet {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Footer */
.footer {
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: auto;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.75rem 1rem;
    }
    .main-content {
        padding: 1.25rem 1rem;
    }
    .card-body {
        padding: 1rem;
    }
    .tabs-nav {
        padding: 0 0.5rem;
    }
    .tab-btn {
        padding: 0.75rem 0.65rem;
        font-size: 0.85rem;
    }
    .qr-display-container {
        padding: 1.5rem 1rem;
        min-height: 280px;
    }
}
