/* QR Code Generator - Global Styles */

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color, #1abc9c);
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    transition: top 0.2s;
    font-size: 14px;
    border-radius: 0 0 4px 0;
}
.skip-link:focus {
    top: 0;
}

:root {
    --primary-color: #1abc9c;
    --primary-dark: #16a085;
    --primary-light: #48dbcc;
    --secondary-color: #2c3e50;
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a3e;
    --bg-tertiary: #25254a;
    --text-primary: #e0e0f8;
    --text-secondary: #a0a0c8;
    --text-tertiary: #707090;
    --border-color: rgba(26, 188, 156, 0.2);
    --border-light: rgba(26, 188, 156, 0.1);
    --shadow-light: rgba(0, 0, 0, 0.2);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --error-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
}

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

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #25254a 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Loading Animation */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.loader-emoji {
    font-size: 60px;
    margin-bottom: 20px;
    animation: bounce 1.5s ease-in-out infinite;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loader-text {
    color: var(--text-secondary);
    font-size: 14px;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

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

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px 20px;
    margin-bottom: 30px;
}

.header-content {
    animation: fadeInDown 0.6s ease;
}

.app-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Ad Banners */
.ad-banner {
    margin: 20px 0;
    padding: 15px;
    background: rgba(26, 188, 156, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-banner ins {
    display: block;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease 0.2s both;
}

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

/* Input Panel */
.input-panel {
    background: rgba(26, 188, 156, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Form Section */
.form-section {
    margin-bottom: 28px;
}

.form-section:last-of-type {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-transform: capitalize;
}

/* Type Buttons */
.type-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
}

.type-btn {
    padding: 10px 12px;
    background: rgba(26, 188, 156, 0.1);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    min-height: 44px;
}

.type-btn:hover {
    background: rgba(26, 188, 156, 0.2);
    color: var(--text-primary);
}

.type-btn.active {
    background: rgba(26, 188, 156, 0.3);
    border-color: var(--primary-color);
    color: var(--primary-light);
    box-shadow: 0 0 20px rgba(26, 188, 156, 0.3);
}

/* Input Fields */
.input-fields {
    position: relative;
    margin-bottom: 20px;
}

.input-group {
    display: none;
    animation: fadeIn 0.3s ease;
}

.input-group.active {
    display: block;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 15, 35, 0.5);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    min-height: 44px;
}

.form-input:focus {
    outline: none;
    background: rgba(15, 15, 35, 0.8);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(26, 188, 156, 0.2);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input.textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Color Picker */
.color-group {
    margin-bottom: 16px;
}

.color-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.color-picker-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker {
    width: 50px;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-picker:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(26, 188, 156, 0.2);
}

.color-value {
    flex: 1;
    padding: 10px 12px;
    background: rgba(15, 15, 35, 0.5);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    user-select: all;
}

/* Size Control */
.size-control {
    display: flex;
    align-items: center;
    gap: 16px;
}

.form-slider {
    flex: 1;
    height: 6px;
    background: rgba(26, 188, 156, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.form-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(26, 188, 156, 0.4);
    transition: all 0.3s ease;
}

.form-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(26, 188, 156, 0.6);
}

.form-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(26, 188, 156, 0.4);
    transition: all 0.3s ease;
}

.form-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(26, 188, 156, 0.6);
}

.size-display {
    min-width: 70px;
    text-align: right;
    font-weight: 600;
    color: var(--primary-light);
}

/* Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 30px;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: capitalize;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(26, 188, 156, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 188, 156, 0.4);
}

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

/* CTA pulse animation for download button */
@keyframes cta-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26, 188, 156, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(26, 188, 156, 0); }
}
.btn-pulse {
    animation: cta-pulse 2s ease-in-out infinite;
}

/* Highlight URL input on first load */
.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.2);
}

.btn-secondary {
    background: rgba(26, 188, 156, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(26, 188, 156, 0.2);
    border-color: var(--primary-color);
}

/* Preview Panel */
.preview-panel {
    background: rgba(26, 188, 156, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* QR Container */
.qr-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    position: relative;
    min-height: 250px;
}

#qr-canvas {
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
}

.empty-state-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    padding: 20px;
    width: 100%;
    max-width: 280px;
    line-height: 1.5;
}

/* QR Statistics */
.qr-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    background: rgba(26, 188, 156, 0.1);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    display: block;
    font-size: 1.1rem;
    color: var(--primary-light);
    font-weight: 700;
}

/* History Section */
.history-section {
    border-top: 1px solid var(--border-light);
    padding-top: 20px;
}

.history-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-transform: capitalize;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(26, 188, 156, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(26, 188, 156, 0.15);
    border-color: var(--primary-color);
}

.history-item-thumbnail {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 4px;
    flex-shrink: 0;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.history-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-light);
    margin-top: 40px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(26, 188, 156, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(26, 188, 156, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 188, 156, 0.5);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: more) {
    :root {
        --border-color: rgba(26, 188, 156, 0.5);
        --text-tertiary: rgba(160, 160, 200, 0.8);
    }
}

/* Dark Mode (Default - Always On) */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #25254a 100%);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 30px 15px 15px;
        margin-bottom: 20px;
    }

    .app-title {
        font-size: 1.8rem;
    }

    .app-subtitle {
        font-size: 0.95rem;
    }

    .input-panel,
    .preview-panel {
        padding: 20px;
    }

    .type-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .type-btn {
        font-size: 0.75rem;
        padding: 8px 10px;
    }

    .qr-stats {
        grid-template-columns: 1fr;
    }

    .stat-item {
        padding: 12px;
    }

    .stat-value {
        font-size: 1rem;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .language-selector {
        top: 12px;
        right: 12px;
    }

    .lang-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 10px 10px;
        margin-bottom: 15px;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .input-panel,
    .preview-panel {
        border-radius: 12px;
        padding: 15px;
    }

    .form-section {
        margin-bottom: 20px;
    }

    .form-label {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .form-input {
        padding: 10px 12px;
        font-size: 0.9rem;
        margin-bottom: 12px;
    }

    .color-picker {
        width: 44px;
        height: 44px;
    }

    .type-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .qr-container {
        padding: 15px;
    }

    .footer {
        font-size: 0.75rem;
    }
}

/* Selection Color */
::selection {
    background: #1a1a3e;
    color: white;
}

::-moz-selection {
    background: #1a1a3e;
    color: white;
}

/* Focus Visible */
button:focus-visible,
a:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid #1a1a3e;
    outline-offset: 2px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f5f5fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f5;
    --text-primary: #1a1a2e;
    --text-secondary: #5a5a70;
    --text-tertiary: #8a8a9e;
    --border-color: rgba(26, 188, 156, 0.15);
    --border-light: rgba(26, 188, 156, 0.1);
    --shadow-light: rgba(26, 188, 156, 0.1);
    --shadow-medium: rgba(26, 188, 156, 0.15);
}

[data-theme="light"] body {
    background: linear-gradient(135deg, #f5f5fa 0%, #e8e8f0 50%, #f5f5fa 100%);
}

[data-theme="light"] .app-loader {
    background: #f5f5fa;
}

[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .ad-banner {
    background: rgba(26, 188, 156, 0.05);
    border-color: rgba(26, 188, 156, 0.15);
}

[data-theme="light"] .input-panel,
[data-theme="light"] .preview-panel {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(26, 188, 156, 0.2);
}

[data-theme="light"] .type-btn {
    background: rgba(26, 188, 156, 0.08);
}

[data-theme="light"] .type-btn:hover {
    background: rgba(26, 188, 156, 0.15);
}

[data-theme="light"] .type-btn.active {
    background: rgba(26, 188, 156, 0.2);
    border-color: var(--primary-color);
}

[data-theme="light"] .form-input {
    background: rgba(245, 245, 250, 0.8);
    border-color: rgba(26, 188, 156, 0.15);
    color: var(--text-primary);
}

[data-theme="light"] .form-input:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary-color);
}

[data-theme="light"] .color-value {
    background: rgba(245, 245, 250, 0.8);
    border-color: rgba(26, 188, 156, 0.15);
}

[data-theme="light"] .form-slider {
    background: rgba(26, 188, 156, 0.1);
}

[data-theme="light"] .btn-secondary {
    background: rgba(26, 188, 156, 0.08);
    border-color: rgba(26, 188, 156, 0.2);
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(26, 188, 156, 0.15);
}

[data-theme="light"] .qr-container {
    background: white;
    box-shadow: 0 4px 15px rgba(26, 188, 156, 0.15);
}

[data-theme="light"] .stat-item {
    background: rgba(26, 188, 156, 0.05);
    border-color: rgba(26, 188, 156, 0.15);
}

[data-theme="light"] .history-item {
    background: rgba(26, 188, 156, 0.05);
    border-color: rgba(26, 188, 156, 0.15);
}

[data-theme="light"] .history-item:hover {
    background: rgba(26, 188, 156, 0.12);
    border-color: var(--primary-color);
}

[data-theme="light"] .history-item-thumbnail {
    background: white;
}

[data-theme="light"] .footer {
    border-top-color: rgba(26, 188, 156, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-track {
    background: rgba(26, 188, 156, 0.05);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(26, 188, 156, 0.2);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 188, 156, 0.35);
}

[data-theme="light"] ::selection {
    background: #1abc9c;
    color: white;
}

[data-theme="light"] ::-moz-selection {
    background: #1abc9c;
    color: white;
}

[data-theme="light"] button:focus-visible,
[data-theme="light"] a:focus-visible,
[data-theme="light"] input:focus-visible,
[data-theme="light"] [role="button"]:focus-visible {
    outline: 3px solid #1abc9c;
    outline-offset: 2px;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 12px;
    right: 56px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

[data-theme="light"] .theme-toggle {
    background: rgba(26, 188, 156, 0.1);
    border-color: rgba(26, 188, 156, 0.2);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(26, 188, 156, 0.2);
}
