/* ===================================
   Reset et Variables
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --success: #10B981;
    --success-dark: #059669;
    --secondary: #6B7280;
    --danger: #EF4444;
    --bg: #F9FAFB;
    --card: #FFFFFF;
    --text: #111827;
    --text-light: #6B7280;
    --border: #E5E7EB;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===================================
   Layout général
   =================================== */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 600px;
    width: 100%;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-align: center;
    color: var(--text);
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: -0.5rem 0 0.5rem 0;
}

.create-fournisseur-zone.hidden,
.create-produit-zone.hidden {
    display: none;
}

/* ===================================
   Zone d'aperçu photo
   =================================== */
.preview-zone {
    background: var(--card);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.preview-zone img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

/* ===================================
   Boutons
   =================================== */
.buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    padding: 16px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    width: 100%;
}

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

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

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #4B5563;
}

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

/* ===================================
   Formulaire
   =================================== */
.form {
    background: var(--card);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.form-group input[readonly] {
    background-color: var(--bg);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===================================
   Lignes de détail
   =================================== */
.lignes-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

.ligne-item {
    background: var(--card);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow);
}

.ligne-item p {
    margin: 4px 0;
    font-size: 0.9rem;
}

.ligne-item strong {
    color: var(--text);
}

/* ===================================
   Écran succès
   =================================== */
.success-icon {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.success-message {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* ===================================
   Loader
   =================================== */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader p {
    color: white;
    font-size: 1.2rem;
    margin-top: 1rem;
}

/* ===================================
   Utilitaires
   =================================== */
.hidden {
    display: none !important;
}

/* ===================================
   Responsive
   =================================== */
@media (max-width: 640px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .form {
        padding: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .btn {
        font-size: 1rem;
        padding: 14px 20px;
    }
}
