/* ============================================
   COUTUPRO - STYLES RESPONSIFS
   Mobile-first, grands boutons, accessibilité
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

/* Conteneurs */
.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.page-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 15px;
    padding-bottom: 80px;
}

/* Cartes d'authentification */
.auth-card {
    background: white;
    border-radius: 32px;
    padding: 30px 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    font-size: 4rem;
    margin-bottom: 10px;
}

.auth-header h1 {
    font-size: 2rem;
    color: #667eea;
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1rem;
}

input, select, textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
}

.input-with-mic {
    display: flex;
    gap: 10px;
}

.input-with-mic input {
    flex: 1;
}

.mic-btn {
    background: #667eea;
    border: none;
    border-radius: 12px;
    padding: 0 15px;
    font-size: 1.2rem;
    cursor: pointer;
    color: white;
}

/* Boutons */
.btn {
    display: block;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-large {
    padding: 18px;
    font-size: 1.3rem;
}

/* Dashboard */
.dashboard-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 15px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 20px;
    margin-bottom: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    font-size: 2.5rem;
}

.logout-btn {
    font-size: 1.5rem;
    text-decoration: none;
    background: #ffebee;
    padding: 10px 15px;
    border-radius: 50%;
}

.welcome {
    margin-bottom: 25px;
    padding: 0 10px;
}

.welcome h2 {
    font-size: 1.8rem;
    color: #333;
}

/* Grille dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.dashboard-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 25px 15px;
    border-radius: 24px;
    text-align: center;
    text-decoration: none;
    color: white;
    transition: transform 0.2s;
}

.dashboard-card:active {
    transform: scale(0.96);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.card-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.card-count {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Retard alert */
.retard-alert {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    padding: 15px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    cursor: pointer;
    font-weight: bold;
}

/* Quick actions */
.quick-actions {
    display: flex;
    gap: 10px;
}

.btn-quick {
    flex: 1;
    background: white;
    border: 2px solid #667eea;
    padding: 14px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-quick:active {
    background: #667eea;
    color: white;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px 0;
}

.back-btn, .add-btn, .edit-btn {
    font-size: 1.8rem;
    text-decoration: none;
    color: #667eea;
    font-weight: bold;
    padding: 5px 10px;
}

.page-header h1 {
    font-size: 1.5rem;
}

/* Clients list */
.clients-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.client-card:active {
    transform: scale(0.98);
    background: #f0f0f0;
}

.client-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.client-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-photo {
    font-size: 2rem;
}

.client-info {
    flex: 1;
}

.client-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.client-phone {
    color: #666;
    font-size: 0.85rem;
}

.client-arrow {
    font-size: 1.5rem;
    color: #ccc;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
}

/* Form upload photo */
.photo-upload {
    border: 2px dashed #ccc;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.photo-preview {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #999;
}

.photo-preview span:first-child {
    font-size: 3rem;
}

/* Categories grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 10px;
}

.category-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn.active {
    border-color: #667eea;
    background: #e8eaf6;
}

.category-icon {
    font-size: 2rem;
}

.category-name {
    font-size: 0.8rem;
    margin-top: 5px;
}

/* Modeles grid */
.modeles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.modele-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
}

.modele-card.selected {
    border-color: #667eea;
    background: #e8eaf6;
}

.modele-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
}

.modele-name {
    margin-top: 8px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Priority buttons */
.priority-buttons {
    display: flex;
    gap: 12px;
}

.priority-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.priority-option:has(input:checked) {
    border-color: #667eea;
    background: #e8eaf6;
}

.priority-option input {
    width: auto;
    margin: 0;
}

/* Payment type */
.payment-type {
    display: flex;
    gap: 20px;
    padding: 10px 0;
}

.payment-type label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    margin: 0;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: bold;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    background: white;
    border-radius: 20px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

/* Mesures fields */
.measure-field {
    margin-bottom: 15px;
}

.measure-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.measure-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.measure-input-group input {
    flex: 1;
}

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

.client-card, .commande-card, .dashboard-card {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 480px) {
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .category-btn {
        padding: 12px;
    }
    
    .category-icon {
        font-size: 1.5rem;
    }
    
    .priority-buttons {
        flex-direction: column;
    }
    
    .modeles-grid {
        grid-template-columns: 1fr;
    }
}

/* Support grand texte pour malvoyants */
.text-large {
    font-size: 1.2rem;
}

/* Vibration simulation (CSS pour retour visuel) */
.btn:active, .client-card:active, .dashboard-card:active {
    transform: scale(0.96);
    transition: transform 0.05s;
}

/* ============================================
   PAGES COMMANDES / PAIEMENTS / MODÈLES
   ============================================ */

/* Fiche client */
.client-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 15px;
}

.profile-photo img, .no-photo-large {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.profile-info h2 { margin-bottom: 6px; }
.profile-info p { color: #666; font-size: 0.95rem; }

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

.btn-action {
    padding: 14px;
    border: none;
    border-radius: 16px;
    background: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.btn-secondary {
    background: white;
    color: #444;
    border: 2px solid #ddd;
}

.btn-danger {
    background: #ffebee;
    color: #c62828;
}

.btn-success {
    background: linear-gradient(135deg, #43a047, #66bb6a);
    color: white;
}

.btn + .btn, form + form, .btn + form, form + .btn { margin-top: 10px; }

/* Cartes commandes */
.commandes-list { margin-top: 10px; }

.commande-card {
    background: white;
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: block;
    color: inherit;
    text-decoration: none;
}

.commande-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.commande-icon { font-size: 1.5rem; }
.commande-modele { flex: 1; font-weight: bold; }
.commande-statut { font-size: 0.85rem; white-space: nowrap; }

.commande-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 0.85rem;
    color: #666;
}

.commande-priorite {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.8rem;
    padding: 2px 10px;
    border-radius: 20px;
    background: #f0f0f0;
}

.commande-priorite.urgente { background: #fff3e0; }
.commande-priorite.tres_urgente { background: #ffebee; }

.reste-a-payer { color: #c62828; font-weight: bold; }
.solde { color: #2e7d32; font-weight: bold; }

.empty-state-small {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 16px;
    color: #888;
}

/* Filtres (puces) */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.chip {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 20px;
    background: white;
    color: #444;
    text-decoration: none;
    font-size: 0.9rem;
    border: 2px solid transparent;
}

.chip.active {
    border-color: #667eea;
    color: #667eea;
    font-weight: bold;
}

/* Blocs d'information */
.info-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 15px;
}

.info-card h3 { margin-bottom: 10px; font-size: 1.05rem; }

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f2f2f2;
}

.info-row:last-child { border-bottom: none; }
.info-row span:first-child { color: #777; }

.tissu-photo {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 12px;
}

/* Boutons de statut */
.statut-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.statut-btn {
    padding: 12px 8px;
    border: 2px solid #eee;
    border-radius: 14px;
    background: #fafafa;
    font-size: 0.95rem;
    cursor: pointer;
}

.statut-btn.active {
    border-color: #667eea;
    background: #eef0ff;
    font-weight: bold;
}

/* Barre de progression des paiements */
.progress {
    height: 10px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #43a047, #66bb6a);
}

/* Historique (timeline) */
.timeline { list-style: none; }

.timeline li {
    position: relative;
    padding: 0 0 16px 22px;
    border-left: 2px solid #ddd;
    margin-left: 6px;
}

.timeline li::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #667eea;
}

.timeline li:last-child { border-left-color: transparent; }
.timeline small { color: #888; display: block; }

/* Galerie de modèles */
.modele-card { position: relative; }

.modele-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.modele-delete {
    position: absolute;
    top: 4px;
    right: 4px;
}

.modele-delete button {
    border: none;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
}

.no-photo-modele {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: #f5f5f5;
    border-radius: 12px;
}

.section-title {
    margin: 18px 0 10px;
    font-size: 1.1rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.checkbox-row input { width: 22px; height: 22px; }

select, textarea, input[type="date"], input[type="number"] {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
}

/* Actions rapides du tableau de bord : 2 par ligne */
.quick-actions { flex-wrap: wrap; }
.quick-actions .btn-quick { flex: 1 1 45%; }
.info-row > :last-child { white-space: nowrap; text-align: right; }

/* Fiche commande : modèle + tissu côte à côte pour le tailleur */
.photos-atelier {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
}

.photo-titre {
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 6px;
}

.photos-atelier .tissu-photo {
    height: 220px;
    object-fit: contain;
    background: #f5f5f5;
}

.photo-manquante {
    height: 220px;
    border: 2px dashed #ddd;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.85rem;
    color: #888;
    line-height: 1.6;
}
