/**
 * Styles pour l'interface du générateur de QR Code
 * Design cohérent avec Spleen Creation
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

.mobile-preview-btn {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    padding: 14px 18px;
    border: none;
    background: #2c3e50;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    z-index: 1000;
    display: none;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.12);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 50px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

.mobile-preview-btn:active {
    opacity: 0.9;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 100%;
}

header {
    background: white;
    color: #2c3e50;
    padding: 30px 40px;
    border-bottom: 1px solid #e8e8e8;
    width: 100%;
    box-sizing: border-box;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.header-logo {
    flex-shrink: 0;
}

.header-logo a {
    display: block;
    text-decoration: none;
    transition: opacity 0.2s;
}

.header-logo a:hover {
    opacity: 0.8;
}

.logo-img {
    height: 50px;
    width: auto;
    display: block;
}

.header-text {
    flex: 1;
}

header h1 {
    font-size: 1.8em;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: #2c3e50;
}

.subtitle {
    font-size: 0.95em;
    color: #666;
    font-weight: 300;
    margin: 0;
}

/* Responsive Header */
@media (max-width: 968px) {
    header {
        padding: 25px 30px;
    }
    
    .header-content {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 20px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .logo-img {
        height: 40px;
    }
    
    header h1 {
        font-size: 1.4em;
        margin-bottom: 6px;
    }
    
    .subtitle {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    header {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.2em;
    }
    
    .subtitle {
        font-size: 0.8em;
    }
    
    .logo-img {
        height: 35px;
    }
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 40px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 20px;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px;
        gap: 15px;
    }

    .mobile-preview-btn {
        display: block;
    }
}

.form-section {
    background: #fafafa;
    padding: 30px;
    border-radius: 6px;
    border: 1px solid #e8e8e8;
    width: 100%;
    box-sizing: border-box;
}

.section-divider {
    border: none;
    border-top: 1px solid #e8e8e8;
    margin: 20px 0 14px 0;
}

.advanced-dropdown {
    width: 100%;
}

.preview-section {
    background: #fafafa;
    padding: 30px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #e8e8e8;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .form-section,
    .preview-section {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .form-section,
    .preview-section {
        padding: 15px;
    }
}

.preview-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.3em;
    font-weight: 600;
}

@media (max-width: 768px) {
    .preview-section h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .preview-section h2 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
}

.preview-container {
    background: white;
    padding: 25px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 260px;
    border: 1px solid #e8e8e8;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

#qrcode {
    max-width: 100%;
    height: auto;
    width: 100%;
}

#qrcode canvas,
#qrcode img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .preview-container {
        padding: 20px;
        min-height: 240px;
    }
}

@media (max-width: 480px) {
    .preview-container {
        padding: 15px;
        min-height: 200px;
    }
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.form-group .row {
    margin-bottom: 14px;
}

.form-group .row:last-child {
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .form-group {
        margin-bottom: 16px;
    }
}

.stacked-inputs {
    display: grid;
    gap: 8px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
    background: white;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

@media (max-width: 480px) {
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="tel"],
    .form-group input[type="url"],
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }
}

.form-group input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
    background: white;
    appearance: textfield;
    -moz-appearance: textfield;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .form-group input[type="number"] {
        padding: 10px 12px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }
}

.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group input[type="color"] {
    width: 100%;
    height: 45px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .form-group input[type="color"] {
        height: 50px; /* Plus facile à toucher sur mobile */
    }
}

.form-group input[type="file"] {
    width: 100%;
    padding: 0;
    border: none;
    font-size: 14px;
    cursor: pointer;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .form-group input[type="file"] {
        font-size: 16px;
    }
}

.form-group input[type="file"]::file-selector-button {
    padding: 10px 20px;
    margin-right: 12px;
    border: 1px solid #2c3e50;
    border-radius: 6px;
    background: #2c3e50;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

@media (max-width: 480px) {
    .form-group input[type="file"]::file-selector-button {
        padding: 12px 16px;
        font-size: 14px;
        margin-right: 8px;
    }
}

.form-group input[type="file"]::file-selector-button:hover {
    background: #34495e;
    border-color: #34495e;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.form-group input[type="color"]:hover {
    border-color: #bbb;
    transform: scale(1.02);
}

.form-group input[type="color"]:focus {
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .form-group textarea {
        min-height: 80px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }
}

/* Amélioration du select */
.form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232c3e50' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.form-group select:hover {
    border-color: #bbb;
}

/* Amélioration des inputs number */
.form-group input[type="number"]:hover {
    border-color: #bbb;
}

/* Amélioration du file input focus */
.form-group input[type="file"]:focus::file-selector-button {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #999;
    font-size: 0.8em;
    line-height: 1.4;
    font-weight: 400;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 480px) {
    .form-group small {
        font-size: 0.75em;
    }
}

/* Sélecteur de type de QR Code - Style balises */
.type-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
}

@media (max-width: 480px) {
    .type-selector {
        gap: 8px;
    }
}

.type-selector input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.type-btn {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    user-select: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 480px) {
    .type-btn {
        padding: 6px 14px;
        font-size: 13px;
        min-height: 36px;
    }
}

.type-btn:hover {
    border-color: #2c3e50;
    background: #f8f9fa;
    color: #2c3e50;
}

.type-selector input[type="radio"]:checked + .type-btn {
    border-color: #2c3e50;
    background: #2c3e50;
    color: white;
}

@media (max-width: 768px) {
    .type-selector {
        flex-direction: column;
    }
    
    .type-btn {
        width: 100%;
        text-align: center;
    }
}

#logoStatus {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    background: #f8f9fa;
    border-left: 3px solid transparent;
}

#logoStatus span[style*="color: #27ae60"] {
    background: #e8f5e9;
    border-left-color: #27ae60;
    padding: 8px 12px;
    border-radius: 6px;
    display: inline-block;
    width: 100%;
}

#logoStatus span[style*="color: #e74c3c"] {
    background: #fee;
    border-left-color: #e74c3c;
    padding: 8px 12px;
    border-radius: 6px;
    display: inline-block;
    width: 100%;
}

#logoStatus span[style*="color: #2c3e50"] {
    background: #f8f9fa;
    border-left-color: #2c3e50;
    padding: 8px 12px;
    border-radius: 6px;
    display: inline-block;
    width: 100%;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

.col-half {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .row {
        gap: 10px;
    }
}

.toggle-btn {
    background: #eef3f8;
    color: #22344a;
    border: 1px solid #c3d1e8;
    padding: 12px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.dropdown-toggle .chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid #2c3e50;
    border-bottom: 2px solid #2c3e50;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.dropdown-toggle[aria-expanded="true"] .chevron {
    transform: rotate(-135deg);
}

@media (max-width: 480px) {
    .toggle-btn {
        padding: 11px 12px;
        font-size: 13px;
        min-height: 40px;
    }
}

.toggle-btn:hover {
    background: #e4ecf6;
    border-color: #aebfdc;
    color: #1c2c44;
}

.toggle-btn:active {
    background: #d9e4f2;
}

.toggle-icon {
    font-size: 15px;
    line-height: 1;
}

.toggle-text {
    flex: 1;
    text-align: left;
}

.advanced-microcopy {
    display: block;
    color: #6a7688;
    font-size: 12.5px;
    margin: -4px 0 10px 0;
}

.logo-actions {
    margin: 8px 0 6px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.remove-logo-link {
    background: transparent;
    border: none;
    color: #5f6f80;
    font-size: 13px;
    font-weight: 500;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color 0.2s ease;
}

.remove-logo-link:hover {
    color: #2c3e50;
    text-decoration: underline;
}

.remove-logo-link:active {
    color: #1c2c44;
}

.advanced-hint {
    display: block;
    margin-top: 8px;
    color: #888;
    font-size: 0.82em;
}

#advancedOptions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-input-wrapper {
    position: relative;
    display: block;
}

.hidden {
    display: none !important;
}


.btn {
    padding: 11px 22px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px; /* Taille minimale pour le touch */
}

@media (max-width: 480px) {
    .btn {
        padding: 12px 16px;
        font-size: 14px;
        width: 100%;
    }
}

.btn-primary {
    background: #2c3e50;
    color: white;
    border: 1px solid #2c3e50;
}

.btn-primary:hover {
    background: #34495e;
    border-color: #34495e;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.2);
}

.btn-secondary {
    background: #7f8c8d;
    color: white;
    border: 1px solid #7f8c8d;
}

.btn-secondary:hover {
    background: #95a5a6;
    border-color: #95a5a6;
    transform: translateY(-1px);
}

.download-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

.download-buttons .btn {
    flex: 1;
    min-width: 130px;
}

@media (max-width: 768px) {
    .download-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .download-buttons .btn {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .download-buttons {
        gap: 10px;
    }
}

.alert {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    border-left: 3px solid;
    font-size: 14px;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}

.alert strong {
    font-weight: 600;
    margin-right: 4px;
    display: inline;
}

.alert-error {
    background: #fee;
    border-color: #e74c3c;
    color: #c0392b;
}

.alert-success {
    background: #e8f5e9;
    border-color: #27ae60;
    color: #229954;
}

/* Responsive général */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .alert {
        margin-bottom: 12px;
        font-size: 13px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .container {
        border-radius: 4px;
    }
    
    .alert {
        font-size: 12px;
        padding: 8px 10px;
    }
    
    .advanced-hint {
        font-size: 0.75em;
    }
    
    .stacked-inputs {
        gap: 6px;
    }
    
    .stacked-inputs input[type="range"] {
        width: 100%;
    }
}

/* Amélioration pour les très petits écrans */
@media (max-width: 360px) {
    body {
        padding: 5px;
    }
    
    header {
        padding: 12px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .form-section,
    .preview-section {
        padding: 12px;
    }
    
    header h1 {
        font-size: 1.1em;
    }
    
    .subtitle {
        font-size: 0.75em;
    }
}
