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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #1a1f3a 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow);
}

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

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.controls-panel, .preview-panel {
    background: var(--surface);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px var(--shadow);
}

.tab-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--bg);
    padding: 5px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

.form-group {
    margin-bottom: 25px;
}

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

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.3s;
}

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

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

.form-group small {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.shape-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
}

.shape-btn, .eye-frame-btn, .eye-ball-btn {
    padding: 10px 6px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s;
    white-space: nowrap;
}

.shape-btn:hover, .eye-frame-btn:hover, .eye-ball-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.shape-btn.active, .eye-frame-btn.active, .eye-ball-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: var(--primary);
    color: white;
}

.color-section {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

/* Custom Color Picker */
.color-picker-wrapper {
    position: relative;
}

.color-input-display {
    width: 100%;
    height: 44px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 6px;
    gap: 10px;
    background: var(--bg);
    transition: all 0.3s;
}

.color-input-display:hover {
    border-color: var(--primary);
}

.color-preview-box {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.color-hex-value {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 600;
}

.color-picker-popup {
    position: absolute;
    top: 50px;
    left: 0;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 8px 24px var(--shadow);
    z-index: 1000;
    display: none;
    width: 260px;
}

.color-picker-popup.active {
    display: block;
    animation: fadeIn 0.2s;
}

.color-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.color-picker-header span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.color-picker-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.color-picker-close:hover {
    background: var(--surface-light);
    color: var(--text);
}

.color-picker-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 140px;
    margin-bottom: 10px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--border);
}

.color-picker-canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.color-picker-cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.color-picker-sliders {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.color-slider-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.color-slider-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

.color-slider-track {
    position: relative;
    height: 80px;
    border-radius: 6px;
    border: 2px solid var(--border);
    overflow: hidden;
}

.color-slider-canvas {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.color-slider-thumb {
    position: absolute;
    left: 50%;
    width: calc(100% + 6px);
    height: 6px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 3px;
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.color-picker-hex-input {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-picker-hex-input span {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.color-picker-hex-input input {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

.form-group input[type="color"] {
    display: none;
}

.form-group input[type="range"] {
    width: calc(100% - 60px);
    margin-right: 10px;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
}

.generate-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

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

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

.remove-logo-btn {
    width: 100%;
    padding: 12px;
    background: #ef4444;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.remove-logo-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Logo Preview */
.logo-preview-container {
    margin-top: 20px;
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    border: 2px solid var(--border);
}

/* Design Preview */
.design-preview-container {
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--border);
    margin-bottom: 24px;
}

/* Accordion */
.accordion-item {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.accordion-item:hover {
    border-color: var(--primary);
}

.accordion-header {
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.accordion-header:hover {
    background: var(--surface-light);
}

.accordion-icon {
    font-size: 0.8rem;
    transition: transform 0.3s;
    color: var(--text-muted);
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
    color: var(--primary);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 20px;
}

.accordion-content.active {
    max-height: 500px;
    padding: 0 20px 16px 20px;
    overflow-y: auto;
}

.accordion-content select {
    width: 100%;
}

/* Shape Options Grid */
.shape-options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.shape-option {
    padding: 10px 8px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shape-option:hover {
    border-color: var(--primary);
    background: var(--surface-light);
}

.shape-option.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: var(--primary);
    color: white;
}

.design-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.design-preview-header span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.design-preview-header small {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.design-preview-qr {
    background: white;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    position: relative;
}

.design-preview-qr img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #999;
}

.preview-placeholder p {
    font-size: 0.9rem;
    margin: 0;
}

.preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 8px;
}

.preview-loading p {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 500;
    margin: 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.preview-refresh-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.preview-refresh-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.preview-refresh-btn span {
    font-size: 1.1rem;
}

.logo-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.logo-preview-header span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.remove-logo-btn-small {
    background: #ef4444;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.85rem;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.logo-preview-image {
    background: 
        linear-gradient(45deg, var(--surface-light) 25%, transparent 25%),
        linear-gradient(-45deg, var(--surface-light) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--surface-light) 75%),
        linear-gradient(-45deg, transparent 75%, var(--surface-light) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

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

/* Modern Checkbox */
.checkbox-group {
    margin-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 16px;
    background: var(--bg);
    border-radius: 12px;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

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

.modern-checkbox {
    display: none;
}

.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s;
}

.modern-checkbox:checked + .checkbox-custom {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: var(--primary);
}

.modern-checkbox:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.checkbox-text strong {
    color: var(--text);
    font-size: 0.95rem;
}

.checkbox-text small {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface);
    color: var(--text);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow);
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid var(--primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast.info {
    border-left-color: var(--primary);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 0.95rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toast-close:hover {
    background: var(--surface-light);
    color: var(--text);
}

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

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

.toast.removing {
    animation: slideOut 0.3s ease-out forwards;
}

.preview-container {
    background: white;
    border-radius: 16px;
    padding: 40px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.qr-preview {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder {
    text-align: center;
    color: #999;
}

.placeholder svg {
    margin-bottom: 20px;
}

.qr-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.download-btn, .copy-btn {
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.download-btn {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.copy-btn {
    background: var(--surface-light);
    color: var(--text);
}

.download-btn:hover:not(:disabled), .copy-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow);
}

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

.presets {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
}

.presets h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.preset-btn {
    padding: 12px;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    animation: pulse 2s ease-in-out infinite;
}

.preset-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(0.98);
    }
}

.preset-btn.loading {
    pointer-events: none;
}

.preset-btn.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 1s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Skeleton loading for preview */
.preview-skeleton {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--surface-light) 25%,
        var(--surface) 50%,
        var(--surface-light) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

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

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .tab-navigation {
        flex-wrap: wrap;
    }
    
    .shape-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
