/* Custom styles for NafaBill */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

/* General styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Navigation */
.navbar-brand {
    font-size: 1.5rem;
}

/* Cards */
.card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* ==============================================
   STYLES SPÉCIFIQUES POUR LES FACTURES/DEVIS
   ============================================== */

/* Amélioration des champs de saisie dans les tableaux */
.item-quantity, .item-price, .item-unit {
    font-size: 14px;
    padding: 8px 10px;
    min-height: 38px;
    text-align: center;
    font-weight: 500;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.item-quantity:focus, .item-price:focus, .item-unit:focus {
    background-color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.item-description {
    font-size: 14px;
    padding: 8px 10px;
    min-height: 38px;
}

.product-select {
    font-size: 14px;
    padding: 8px 10px;
    min-height: 38px;
}

/* Amélioration du tableau des items */
#items-table {
    font-size: 14px;
}

#items-table th {
    font-size: 13px;
    font-weight: 600;
    padding: 12px 8px;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

#items-table td {
    padding: 8px;
    vertical-align: middle;
}

/* Ajustement des largeurs des colonnes */
#items-table th:nth-child(1), /* Produit/Service */
#items-table td:nth-child(1) {
    width: 20%;
    min-width: 150px;
}

#items-table th:nth-child(2), /* Description */
#items-table td:nth-child(2) {
    width: 25%;
    min-width: 180px;
}

#items-table th:nth-child(3), /* Qté */
#items-table td:nth-child(3) {
    width: 12%;
    min-width: 90px;
}

#items-table th:nth-child(4), /* Prix unit. */
#items-table td:nth-child(4) {
    width: 15%;
    min-width: 110px;
}

#items-table th:nth-child(5), /* Unité */
#items-table td:nth-child(5) {
    width: 10%;
    min-width: 80px;
}

#items-table th:nth-child(6), /* Total */
#items-table td:nth-child(6) {
    width: 12%;
    min-width: 120px;
}

#items-table th:nth-child(7), /* Actions */
#items-table td:nth-child(7) {
    width: 6%;
    min-width: 50px;
}

/* Style pour les totaux de ligne */
.line-total {
    background-color: #e3f2fd !important;
    font-weight: bold !important;
    color: #1976d2 !important;
    text-align: right !important;
    font-size: 16px !important;
    padding: 10px 12px !important;
    min-height: 42px !important;
    border: 2px solid #2196f3 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1) !important;
}

.line-total:focus {
    background-color: #bbdefb !important;
    border-color: #1976d2 !important;
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25) !important;
}

/* ==============================================
   OPTIMISATION DU RÉCAPITULATIF
   ============================================== */

/* Réduire la taille du récapitulatif */
#totals-card {
    position: sticky;
    top: 20px;
}

#totals-card .card-body {
    padding: 1rem;
}

#totals-card .d-flex {
    font-size: 14px;
}

/* ==============================================
   RESPONSIVE DESIGN - TABLETTES
   ============================================== */

@media (max-width: 1024px) {
    /* Augmenter légèrement les champs sur tablette */
    .item-quantity, .item-price, .item-unit {
        font-size: 15px;
        padding: 10px 8px;
        min-height: 42px;
    }
    
    .item-description {
        font-size: 15px;
        padding: 10px 8px;
        min-height: 42px;
    }
    
    .product-select {
        font-size: 15px;
        padding: 10px 8px;
        min-height: 42px;
    }
    
    /* Ajuster les largeurs minimales */
    #items-table th:nth-child(3),
    #items-table td:nth-child(3) {
        min-width: 100px;
    }
    
    #items-table th:nth-child(4),
    #items-table td:nth-child(4) {
        min-width: 120px;
    }
    
    #items-table th:nth-child(5),
    #items-table td:nth-child(5) {
        min-width: 90px;
    }
}

/* ==============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================== */

@media (max-width: 768px) {
    /* Augmenter significativement la taille des champs sur mobile */
    .item-quantity, .item-price, .item-unit {
        font-size: 16px !important; /* Évite le zoom sur iOS */
        padding: 12px 10px !important;
        min-height: 48px !important; /* Taille recommandée pour mobile */
        border-radius: 8px;
    }
    
    .item-description {
        font-size: 16px !important;
        padding: 12px 10px !important;
        min-height: 48px !important;
        border-radius: 8px;
    }
    
    .product-select {
        font-size: 16px !important;
        padding: 12px 10px !important;
        min-height: 48px !important;
        border-radius: 8px;
    }
    
    /* Améliorer la lisibilité des placeholders */
    .item-quantity::placeholder,
    .item-price::placeholder,
    .item-unit::placeholder {
        font-size: 15px;
        color: #6c757d;
    }
    
    /* Totaux de ligne encore plus visibles sur mobile */
    .line-total {
        font-size: 18px !important;
        padding: 14px 12px !important;
        min-height: 52px !important;
        background-color: #e8f5e8 !important;
        color: #2e7d32 !important;
        border: 3px solid #4caf50 !important;
        font-weight: 700 !important;
    }
    
    .line-total:focus {
        background-color: #c8e6c9 !important;
        border-color: #2e7d32 !important;
    }
    
    /* Ajuster les largeurs des colonnes sur mobile */
    #items-table th:nth-child(1),
    #items-table td:nth-child(1) {
        width: 18%;
        min-width: 120px;
    }
    
    #items-table th:nth-child(2),
    #items-table td:nth-child(2) {
        width: 22%;
        min-width: 140px;
    }
    
    #items-table th:nth-child(3),
    #items-table td:nth-child(3) {
        width: 15%;
        min-width: 100px;
    }
    
    #items-table th:nth-child(4),
    #items-table td:nth-child(4) {
        width: 18%;
        min-width: 120px;
    }
    
    #items-table th:nth-child(5),
    #items-table td:nth-child(5) {
        width: 12%;
        min-width: 90px;
    }
    
    #items-table th:nth-child(6),
    #items-table td:nth-child(6) {
        width: 10%;
        min-width: 100px;
    }
    
    #items-table th:nth-child(7),
    #items-table td:nth-child(7) {
        width: 5%;
        min-width: 40px;
    }
    
    /* Réduire la taille des en-têtes de tableau */
    #items-table th {
        font-size: 12px;
        padding: 10px 6px;
    }
    
    #items-table td {
        padding: 6px;
    }
    
    /* Optimiser le récapitulatif sur mobile */
    #totals-card {
        position: static;
        margin-top: 1rem;
    }
    
    #totals-card .card-body {
        padding: 0.75rem;
    }
    
    #totals-card .d-flex {
        font-size: 13px;
    }
    
    /* Améliorer les boutons sur mobile */
    .btn-sm {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* Optimiser l'espacement du tableau */
    .table-responsive {
        font-size: 13px;
    }
}

/* ==============================================
   RESPONSIVE DESIGN - TRÈS PETITS ÉCRANS
   ============================================== */

@media (max-width: 576px) {
    /* Encore plus grand sur très petits écrans */
    .item-quantity, .item-price, .item-unit {
        font-size: 18px !important;
        padding: 14px 12px !important;
        min-height: 52px !important;
    }
    
    .item-description {
        font-size: 18px !important;
        padding: 14px 12px !important;
        min-height: 52px !important;
    }
    
    .product-select {
        font-size: 18px !important;
        padding: 14px 12px !important;
        min-height: 52px !important;
    }
    
    /* Réduire encore plus les largeurs minimales */
    #items-table th:nth-child(1),
    #items-table td:nth-child(1) {
        min-width: 100px;
    }
    
    #items-table th:nth-child(2),
    #items-table td:nth-child(2) {
        min-width: 120px;
    }
    
    #items-table th:nth-child(3),
    #items-table td:nth-child(3) {
        min-width: 80px;
    }
    
    #items-table th:nth-child(4),
    #items-table td:nth-child(4) {
        min-width: 100px;
    }
    
    #items-table th:nth-child(5),
    #items-table td:nth-child(5) {
        min-width: 70px;
    }
    
    #items-table th:nth-child(6),
    #items-table td:nth-child(6) {
        min-width: 70px;
    }
    
    #items-table th:nth-child(7),
    #items-table td:nth-child(7) {
        min-width: 35px;
    }
}

/* Dashboard stats cards */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 1rem;
}

.stats-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-card p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

/* Invoice/Quote status badges */
.badge-draft {
    background-color: #6c757d;
}

.badge-sent {
    background-color: #0dcaf0;
}

.badge-paid {
    background-color: #198754;
}

.badge-overdue {
    background-color: #dc3545;
}

.badge-cancelled {
    background-color: #343a40;
}

/* Table styling */
.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.table th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Hero section */
.min-vh-75 {
    min-height: 75vh;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .stats-card {
        padding: 1.5rem;
        text-align: center;
    }
    
    .stats-card h3 {
        font-size: 2rem;
    }
}

/* Print styles */
@media print {
    .navbar, .footer, .btn, .no-print {
        display: none !important;
    }
    
    body {
        padding: 0;
        margin: 0;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}

/* File upload styling */
.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-upload-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-upload-label {
    cursor: pointer;
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}

.file-upload-label:hover {
    background-color: #e9ecef;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Alert improvements */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Footer */
footer {
    margin-top: auto;
} 