/* Modern Professional QR Generator - Complete Redesign */

/* ========================================
   RESET & BASE STYLES
   ======================================== */

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

:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;

    /* Grays */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Status Colors */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-base: all 0.2s ease;
    --transition-slow: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.hero-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" fill="white" fill-opacity="0.1"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: var(--space-sm) var(--space-lg);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hero-header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.95;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */

.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto 2rem auto;
    padding: var(--space-2xl) var(--space-lg);
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: var(--space-2xl);
    width: 100%;
}

/* ========================================
   PREVIEW PANEL (LEFT)
   ======================================== */

.preview-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    position: sticky;
    top: var(--space-xl);
    align-self: flex-start;
    max-height: calc(100vh - var(--space-2xl) - var(--space-2xl));
}

.preview-card {
    background: white;
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.preview-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.preview-meta {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.qr-preview-area {
    min-height: 400px;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
    border: 2px dashed var(--gray-300);
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    text-align: center;
    padding: var(--space-2xl);
}

.placeholder-icon {
    margin-bottom: var(--space-lg);
    opacity: 0.3;
}

.placeholder-icon svg {
    color: var(--primary);
}

.preview-placeholder h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-sm);
}

.preview-placeholder p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

#qrImage {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Download Buttons */
.download-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-base);
    font-family: inherit;
}

.btn-download-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

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

.btn-download-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
}

.btn-download-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* Message Boxes */
.message-box {
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: slideIn 0.3s ease;
}

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

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

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

/* Tips Card */
.tips-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    border: 1px solid #fbbf24;
}

.tips-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-md);
}

.tips-card ul {
    list-style: none;
}

.tips-card li {
    padding-left: var(--space-lg);
    margin-bottom: var(--space-sm);
    position: relative;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.tips-card li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #f59e0b;
    font-weight: 700;
}

/* ========================================
   CONFIG PANEL (RIGHT)
   ======================================== */

.config-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    padding-bottom: var(--space-2xl);
}

.form-section {
    background: white;
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--gray-100);
}

.section-header svg {
    color: var(--primary);
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* Form Fields */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-field label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.required {
    color: var(--error);
}

.form-field input {
    padding: var(--space-md);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: var(--transition-base);
    background: var(--gray-50);
}

.form-field input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ========================================
   TEMPLATE SHOWCASE
   ======================================== */

.template-showcase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

.template-card {
    background: var(--gray-50);
    border: 3px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    cursor: pointer;
    transition: var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: var(--transition-slow);
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.template-card:hover::before {
    opacity: 1;
}

.template-card.active {
    border-color: var(--primary);
    background: white;
    box-shadow: var(--shadow-lg);
}

.template-card.active::before {
    opacity: 1;
}

.template-card.active::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    animation: checkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkPop {
    0% {
        transform: scale(0) rotate(-180deg);
    }
    70% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0);
    }
}

.template-visual {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    color: var(--gray-800);
    transition: var(--transition-base);
}

.template-card:hover .template-visual {
    transform: scale(1.05) rotate(2deg);
    color: var(--primary);
}

.template-visual svg {
    width: 100%;
    height: 100%;
}

.template-info {
    text-align: center;
}

.template-info h4 {
    font-weight: 700;
    color: var(--gray-900);
    font-size: 1rem;
    margin-bottom: var(--space-xs);
}

.template-info p {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ========================================
   COLOR PALETTE
   ======================================== */

.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.color-swatch {
    background: white;
    border: 3px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    cursor: pointer;
    transition: var(--transition-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    font-family: inherit;
    position: relative;
}

.color-swatch:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.color-swatch.active {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.color-swatch.active::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    animation: checkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.swatch-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.color-swatch:hover .swatch-preview {
    transform: scale(1.1) rotate(5deg);
}

.color-swatch span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Custom Color Inputs */
.color-custom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
}

.color-custom label {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.color-custom label span {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.color-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: white;
    padding: var(--space-sm);
    border-radius: var(--radius-lg);
    border: 2px solid var(--gray-300);
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.color-input-group span {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* ========================================
   LOGO UPLOAD
   ======================================== */

.logo-upload-zone {
    border: 3px dashed var(--gray-300);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-base);
    background: var(--gray-50);
}

.logo-upload-zone:hover {
    border-color: var(--primary);
    background: white;
}

.logo-prompt svg {
    color: var(--gray-400);
    margin-bottom: var(--space-md);
}

.logo-prompt h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-sm);
}

.logo-prompt p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.logo-preview-area {
    position: relative;
    display: inline-block;
}

.logo-preview-area img {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.btn-remove-logo {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--error);
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.btn-remove-logo:hover {
    transform: scale(1.1);
    background: #dc2626;
}

/* Logo Padding Control */
.logo-padding-control {
    margin-top: var(--space-lg);
    padding: var(--space-lg);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    animation: slideIn 0.3s ease;
}

.logo-padding-control label {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.logo-padding-control label span {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-700);
}

.logo-padding-control label small {
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-weight: 400;
}

.slider-control {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.slider-control input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--gray-300) 0%, var(--primary) 100%);
    outline: none;
    -webkit-appearance: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.slider-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-lg);
}

.slider-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.slider-control input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-lg);
}

.slider-value {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--primary);
    min-width: 45px;
    text-align: center;
}

.padding-preview {
    padding: var(--space-sm) 0;
}

.padding-indicators {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xs);
}

.indicator-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 600;
}

.indicator-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gray-300);
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
}

.indicator-dot:hover {
    background: var(--gray-400);
    transform: scale(1.2);
}

.indicator-dot.active {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* ========================================
   SIZE OPTIONS
   ======================================== */

.size-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

.size-radio {
    cursor: pointer;
}

.size-radio input[type="radio"] {
    display: none;
}

.size-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: var(--gray-50);
    border: 3px solid var(--gray-200);
    border-radius: var(--radius-lg);
    transition: var(--transition-base);
    text-align: center;
    gap: var(--space-xs);
}

.size-radio:hover .size-box {
    border-color: var(--primary);
    background: white;
    transform: translateY(-2px);
}

.size-radio input:checked + .size-box {
    border-color: var(--primary);
    background: white;
    box-shadow: var(--shadow-md);
}

.size-box strong {
    font-size: 1rem;
    color: var(--gray-900);
}

.size-box small {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ========================================
   GENERATE BUTTON
   ======================================== */

.btn-generate {
    width: 100%;
    padding: var(--space-lg) var(--space-2xl);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-size: 1.125rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    box-shadow: var(--shadow-xl);
    transition: var(--transition-base);
}

.btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 20px 30px -10px rgba(102, 126, 234, 0.5);
}

.btn-generate:active:not(:disabled) {
    transform: translateY(0);
}

.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

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

.app-footer {
    text-align: center;
    padding: var(--space-2xl) var(--space-xl);
    margin-top: var(--space-2xl);
    color: var(--gray-600);
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

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

@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 400px 1fr;
        gap: var(--space-xl);
    }

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

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

    .preview-panel {
        position: static;
        max-height: none;
    }

    .template-showcase {
        grid-template-columns: repeat(3, 1fr);
    }

    .color-palette {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: var(--space-lg) var(--space-md);
    }

    .hero-header {
        padding: var(--space-xl) var(--space-md);
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

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

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

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

    .download-section {
        grid-template-columns: 1fr;
    }

    .color-custom {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .template-showcase {
        grid-template-columns: 1fr;
    }

    .form-section {
        padding: var(--space-lg);
    }
}
