/* ============================================
   QR CODE GENERATOR - STYLESHEET
   ============================================ */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --bg-color: #ffffff;
    --bg-alt: #f8f9fa;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --error-color: #ef4444;
    --success-color: #10b981;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Dark Mode */
body.dark-mode {
    --bg-color: #1f2937;
    --bg-alt: #111827;
    --text-color: #f3f4f6;
    --text-light: #d1d5db;
    --border-color: #374151;
}

/* ============================================
   RESET & GLOBAL STYLES
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxgen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    animation: fadeIn 0.5s ease-in;
}

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

/* ============================================
   HEADER
   ============================================ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 0 30px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-content p {
    color: var(--text-light);
    font-size: 1rem;
}

.dark-mode-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px;
}

.dark-mode-btn:hover {
    transform: scale(1.1);
}

/* ============================================
   INPUT SECTION
   ============================================ */

.input-section {
    background: var(--bg-alt);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    gap: 10px;
}

textarea {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: mono;
    font-size: 0.95rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea::placeholder {
    color: var(--text-light);
}

.copy-btn {
    background: var(--primary-light);
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.char-count {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    flex: 1;
    min-width: 150px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-alt);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    min-width: 100px;
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-download {
    background: var(--primary-color);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-download:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-lg);
}

.btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-small:hover {
    opacity: 0.9;
}

/* ============================================
   LAYOUT WRAPPER (FLEX COLUMNS)
   ============================================ */

.layout-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* ============================================
   CUSTOMIZATION PANEL
   ============================================ */

.customization-panel {
    background: var(--bg-alt);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    height: fit-content;
}

.customization-panel h2,
.preview-section h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-color);
}

.custom-group {
    margin-bottom: 20px;
}

.custom-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.custom-group small {
    display: block;
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 4px;
}

.color-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
}

input[type="color"] {
    width: 50px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

input[type="color"]:hover {
    border-color: var(--primary-color);
}

.color-value {
    font-family: mono;
    font-size: 0.9rem;
    color: var(--text-light);
    flex: 1;
}

select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
}

.custom-group.checkbox {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
}

.custom-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    cursor: pointer;
}

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

/* ============================================
   PREVIEW SECTION
   ============================================ */

.preview-section {
    background: var(--bg-alt);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.qr-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    min-height: 300px;
    margin-bottom: 20px;
    position: relative;
    transition: var(--transition);
    padding: 20px;
}

.qr-preview:hover {
    border-color: var(--primary-light);
}

.preview-placeholder {
    color: var(--text-light);
    text-align: center;
    font-size: 0.95rem;
}

#qrPreview canvas {
    max-width: 100%;
    height: auto;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    text-align: center;
    padding: 30px 0 20px;
    border-top: 2px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer p {
    margin: 6px 0;
}

.text-small {
    font-size: 0.8rem !important;
}

/* ============================================
   ERROR MESSAGE
   ============================================ */

.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--error-color);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        padding: 30px 0 20px;
        gap: 15px;
    }

    .header-content h1 {
        font-size: 1.8rem;
    }

    .header-content p {
        font-size: 0.9rem;
    }

    .layout-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .copy-btn {
        width: 100%;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    textarea {
        font-size: 1rem;
    }

    .customization-panel {
        height: auto;
    }

    .qr-preview {
        min-height: 250px;
    }

    .error-message {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .main-content,
    .input-section,
    .customization-panel,
    .preview-section {
        padding: 20px;
    }

    .action-buttons {
        gap: 10px;
    }

    .btn {
        font-size: 0.85rem;
        padding: 10px 16px;
    }

    textarea {
        font-size: 1rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body,
    .container {
        background: white;
        color: black;
    }

    .header,
    .input-section,
    .customization-panel,
    .footer,
    .action-buttons {
        display: none;
    }

    .qr-preview {
        border: none;
        min-height: auto;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

focus:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
