/* XALPATI QR Generator - Compact Responsive Styles */

:root {
    --primary: #1e3a8a;
    --primary-hover: #1e40af;
    --accent: #10b981;
    --danger: #ef4444;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --radius: 0.5rem;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary) 100%);
    color: var(--gray-700);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}

.logo {
    width: 55px;
    height: auto;
}

.header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.375rem;
}

.mode-tabs {
    display: flex;
    gap: 0.375rem;
    background: var(--gray-100);
    padding: 0.375rem;
    border-radius: 0.375rem;
}

.mode-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

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

.mode-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 550px 1fr;
    gap: 2rem;
    flex: 1;
}

/* Controls Sidebar */
.controls {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    height: fit-content;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    overflow-x: visible;
    position: relative;
}

.controls::-webkit-scrollbar {
    width: 6px;
}

.controls::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.controls::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

/* Form */
.qr-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

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

label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
}

.color-label-clickable {
    cursor: pointer;
    transition: color 0.2s;
    user-select: none;
}

.color-label-clickable:hover {
    color: var(--primary);
}

.char-counter {
    float: right;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    font-family: monospace;
}

.char-counter.warning {
    color: #f59e0b;
    font-weight: 600;
}

/* Content Type Tabs */
.content-type-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.625rem;
}

.content-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.75rem 0.5rem;
    border: 2px solid var(--gray-200);
    background: white;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-icon {
    width: 24px;
    height: 24px;
}

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

.content-tab.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.input-select,
input[type="text"],
input[type="url"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.input-select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

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

/* Range Inputs */
.input-range {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--gray-200);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.input-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.input-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 600;
}

.range-value {
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 600;
}

.quick-btns {
    display: flex;
    gap: 0.5rem;
}

.quick-btn {
    padding: 0.5rem 0.875rem;
    border: 1.5px solid var(--gray-300);
    background: white;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Color Picker */
.color-picker {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.color-preview {
    width: 50px;
    height: 42px;
    border: 1.5px solid var(--gray-200);
    border-radius: 0.5rem;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.color-preview:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.color-picker input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: auto;
    left: -9999px;
}

.color-picker span {
    flex: 1;
    padding: 0.625rem 0.75rem;
    background: var(--gray-100);
    border: 1.5px solid var(--gray-200);
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.color-picker span:hover {
    border-color: var(--primary);
}

/* Custom Color Picker Popup */
.custom-color-picker {
    position: fixed;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    display: none;
    min-width: 300px;
    max-width: 90vw;
}

.custom-color-picker.active {
    display: block;
}

.color-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.color-picker-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin: 0;
}

.color-picker-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-600);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.color-picker-close:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.color-preset-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.color-preset-item {
    width: 36px;
    height: 36px;
    border: 2px solid var(--gray-200);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.color-preset-item:hover {
    border-color: var(--primary);
    transform: scale(1.1);
}

.color-preset-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.2);
}

.color-input-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.color-input-section label {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
    display: block;
}

.color-hex-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 0.375rem;
    font-family: monospace;
    font-size: 0.875rem;
    text-transform: uppercase;
}

.color-hex-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Advanced Color Sliders */
.color-sliders-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.color-sliders-section h5 {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: 0.625rem;
    font-weight: 600;
}

.intensity-hint {
    display: flex;
    justify-content: space-between;
    margin-top: 0.375rem;
    font-size: 0.6875rem;
    color: var(--gray-500);
}

.intensity-hint span {
    flex: 1;
    text-align: center;
}

.intensity-hint span:first-child {
    text-align: left;
}

.intensity-hint span:last-child {
    text-align: right;
}

.color-slider-intensity::-webkit-slider-thumb {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary) 50%, var(--gray-300) 100%);
}

.color-slider-intensity::-moz-range-thumb {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary) 50%, var(--gray-300) 100%);
}

.color-slider-group {
    margin-bottom: 0.5rem;
}

.color-slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.color-slider-label span:first-child {
    font-size: 0.75rem;
    color: var(--gray-600);
    font-weight: 500;
}

.color-slider-label span:last-child {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    font-family: monospace;
}

.color-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--gray-200);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.color-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.color-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Color Preview in Picker */
.color-current-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 0.375rem;
}

.color-current-preview-box {
    width: 48px;
    height: 48px;
    border: 2px solid var(--gray-200);
    border-radius: 0.375rem;
    flex-shrink: 0;
}

.color-current-preview-info {
    flex: 1;
}

.color-current-preview-info p {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin: 0 0 0.25rem 0;
}

.color-current-preview-info h5 {
    font-size: 0.9375rem;
    font-family: monospace;
    color: var(--gray-900);
    margin: 0;
    font-weight: 600;
}

/* Color Swatches */
.color-swatches {
    display: flex;
    gap: 0.625rem;
}

.swatch {
    width: 36px;
    height: 36px;
    border: 2px solid var(--gray-200);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.swatch:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Style Options */
.style-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.style-options-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
}

.style-opt,
.corner-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    border: 2px solid var(--gray-200);
    background: white;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.style-options-grid .style-opt {
    padding: 0.75rem 0.5rem;
    gap: 0.375rem;
}

.style-options-grid .style-opt span {
    font-size: 0.6875rem;
    text-align: center;
    line-height: 1.2;
}

.style-opt svg,
.corner-opt svg {
    width: 32px;
    height: 32px;
}

.style-options-grid .style-opt svg {
    width: 28px;
    height: 28px;
}

.style-opt:hover,
.corner-opt:hover {
    border-color: var(--primary);
}

.style-opt.active,
.corner-opt.active,
.font-opt.active {
    border-color: var(--primary);
    background: rgba(30, 58, 138, 0.05);
    color: var(--primary);
}

.font-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    border: 2px solid var(--gray-200);
    background: white;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.font-opt:hover {
    border-color: var(--primary);
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.9375rem;
}

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

.checkbox-label.small {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Collapsible */
.collapsible {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 0.5rem;
}

/* File Upload */
.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 2px dashed var(--gray-300);
    background: white;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.file-label:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.file-label .icon {
    width: 22px;
    height: 22px;
}

.logo-thumb {
    position: relative;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: white;
    border: 1.5px solid var(--gray-200);
    border-radius: 0.375rem;
    text-align: center;
}

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

.remove-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: #dc2626;
}

/* Buttons */
.btn-reset {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--gray-300);
    background: white;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Actions */
.actions {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding-top: 1.25rem;
    border-top: 2px solid var(--gray-200);
}

.btn-primary {
    padding: 1rem 1.25rem;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 0.5rem;
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.download-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    border: 1.5px solid var(--accent);
    background: white;
    color: var(--accent);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-download svg {
    flex-shrink: 0;
}

.btn-download:hover:not(:disabled) {
    background: var(--accent);
    color: white;
}

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

/* Preview */
.preview {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: fit-content;
}

.preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 500px;
    max-height: 500px;
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 2.5rem;
    overflow: hidden;
}

.placeholder {
    text-align: center;
    color: var(--gray-300);
}

.placeholder svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder p {
    font-size: 1rem;
    font-weight: 500;
}

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

#qrcode canvas {
    max-width: 450px !important;
    max-height: 450px !important;
    width: 450px !important;
    height: 450px !important;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

#qrTextDisplay {
    font-family: 'Inter', sans-serif;
    text-align: center;
    margin-top: 0.5rem;
    word-wrap: break-word;
    max-width: 450px;
}

.preview-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--primary);
}

/* Footer */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    margin-top: 1rem;
    color: white;
    font-size: 0.875rem;
}

.footer a {
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.footer a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .controls {
        max-height: none;
        order: 2;
    }

    .preview {
        order: 1;
    }

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

@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    .header {
        flex-direction: column;
        text-align: center;
    }

    .header h1 {
        font-size: 1.125rem;
    }

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

    .style-options {
        grid-template-columns: 1fr 1fr;
    }

    .content-type-tabs {
        grid-template-columns: 1fr;
    }

    .content-tab {
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }

    .preview-box {
        min-height: 350px;
        max-height: 350px;
        padding: 1.5rem;
    }

    #qrcode canvas {
        max-width: 300px !important;
        max-height: 300px !important;
        width: 300px !important;
        height: 300px !important;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.625rem 0.875rem;
    }

    .logo {
        width: 40px;
    }

    .mode-tabs {
        width: 100%;
    }

    .mode-tab {
        flex: 1;
    }

    .controls,
    .preview {
        padding: 0.875rem;
    }

    .quick-btns {
        flex: 1;
    }

    .quick-btn {
        flex: 1;
    }

    .preview-box {
        min-height: 280px;
        max-height: 280px;
        padding: 1rem;
    }

    #qrcode canvas {
        max-width: 250px !important;
        max-height: 250px !important;
        width: 250px !important;
        height: 250px !important;
    }
}
