/**
 * Styles pour le récapitulatif de total dynamique
 * Fichier : assets/css/chronoloc-total.css
 * 
 * @package ChronoLoc
 * @version 1.0.0
 */

/* ========================================
   Variables CSS
   ======================================== */
:root {
    --cloc-total-primary: #1e3c72;
    --cloc-total-secondary: #8b5cf6;
    --cloc-total-success: #10b981;
    --cloc-total-warning: #f59e0b;
    --cloc-total-danger: #ef4444;
    --cloc-total-gray-50: #f9fafb;
    --cloc-total-gray-100: #f3f4f6;
    --cloc-total-gray-200: #e5e7eb;
    --cloc-total-gray-300: #d1d5db;
    --cloc-total-gray-600: #4b5563;
    --cloc-total-gray-800: #1f2937;
    --cloc-total-border-radius: 12px;
    --cloc-total-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Conteneur principal
   ======================================== */
.cloc-total-wrapper {
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ========================================
   Boîte de total
   ======================================== */
.cloc-total-box {
    background: white;
    border: 2px solid var(--cloc-total-gray-200);
    border-radius: var(--cloc-total-border-radius);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: var(--cloc-total-transition);
    animation: slideIn 0.4s ease-out;
}

.cloc-total-box:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--cloc-total-primary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   En-tête
   ======================================== */
.cloc-total-header {
    background: linear-gradient(135deg, var(--cloc-total-primary), var(--cloc-total-secondary));
    color: white;
    padding: 0px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cloc-total-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
	padding:0px 15px;
}

.cloc-total-icon {
    font-size: 24px;
    animation: pulse 2s infinite;
}

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

.cloc-total-duration {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.cloc-total-days-value {
    font-size: 24px;
    font-weight: 700;
    margin-right: 5px;
}

.cloc-total-days-label {
    font-size: 14px;
    opacity: 0.9;
}

/* ========================================
   Corps
   ======================================== */
.cloc-total-body {
    padding: 20px 20px 0 20px;
	    margin-bottom: -40px;
}

/* Lignes de détail */
.cloc-total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    transition: var(--cloc-total-transition);
}

.cloc-total-line:hover:not(.cloc-total-final) {
    background: var(--cloc-total-gray-50);
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 8px;
}

.cloc-total-line-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.cloc-line-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.cloc-line-text {
    font-size: 15px;
    color: var(--cloc-total-gray-800);
}

.cloc-line-detail {
    font-size: 13px;
    color: var(--cloc-total-gray-600);
    margin-left: 8px;
    background: var(--cloc-total-gray-100);
    padding: 2px 8px;
    border-radius: 12px;
}

.cloc-total-line-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--cloc-total-gray-800);
    white-space: nowrap;
}

/* Séparateur */
.cloc-total-separator {
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--cloc-total-gray-200) 20%, 
        var(--cloc-total-gray-200) 80%, 
        transparent);
    margin: 15px 0;
}

/* Ligne de sous-total */
.cloc-total-subtotal {
    padding-top: 0px;
}

.cloc-total-subtotal-value {
    font-size: 18px;
}

/* Ligne de TVA */
.cloc-total-tax {
    color: var(--cloc-total-gray-600);
}

.cloc-total-tax .cloc-total-line-value {
    color: var(--cloc-total-gray-600);
}

/* Ligne de total final */
.cloc-total-final {
    background: var(--cloc-total-gray-50);
    margin: 15px -20px -20px;
    padding: 5px 20px;
    border-top: 3px solid var(--cloc-total-primary);
}

.cloc-total-final .cloc-line-text {
    font-size: 18px;
    color: var(--cloc-total-primary);
}

.cloc-total-final-value {
    font-size: 24px;
    color: var(--cloc-total-primary);
}

/* ========================================
   Pied de page
   ======================================== */
.cloc-total-footer {
    padding: 0 20px 20px;
}

.cloc-total-messages {
    margin-top: 15px;
}

.cloc-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease-out;
}

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

.cloc-message-icon {
    font-size: 18px;
}

.cloc-message-text {
    font-size: 14px;
    flex: 1;
}

/* Message dates */
.cloc-message-dates {
    background: #fef3c7;
    border-left: 4px solid var(--cloc-total-warning);
    color: #92400e;
}

/* Message transport */
.cloc-message-transport {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

/* Message loading */
/*.cloc-message-loading {
    background: var(--cloc-total-gray-100);
    color: var(--cloc-total-gray-600);
}*/

.cloc-spinner {
    animation: spin 1s linear infinite;
}

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

/* ========================================
   État vide
   ======================================== */
.cloc-total-empty {
    background: var(--cloc-total-gray-50);
    border: 2px dashed var(--cloc-total-gray-300);
    border-radius: var(--cloc-total-border-radius);
    padding: 40px 20px;
    text-align: center;
}

.cloc-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.cloc-empty-text {
    font-size: 16px;
    color: var(--cloc-total-gray-600);
}

/* ========================================
   Styles responsifs
   ======================================== */
@media (max-width: 768px) {
    .cloc-total-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .cloc-total-title {
        font-size: 16px;
    }
    
    .cloc-total-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .cloc-total-line-value {
        font-size: 18px;
        width: 100%;
        text-align: right;
    }
    
    .cloc-total-final {
        margin: 15px -15px -15px;
        padding: 15px;
    }
    
    .cloc-total-final-value {
        font-size: 20px;
    }
}

/* ========================================
   Styles alternatifs (minimal)
   ======================================== */
.cloc-total-wrapper[data-style="minimal"] .cloc-total-box {
    border: 1px solid var(--cloc-total-gray-200);
    box-shadow: none;
}

.cloc-total-wrapper[data-style="minimal"] .cloc-total-header {
    background: var(--cloc-total-gray-100);
    color: var(--cloc-total-gray-800);
    padding: 15px;
}

.cloc-total-wrapper[data-style="minimal"] .cloc-total-body {
    padding: 15px;
}

.cloc-total-wrapper[data-style="minimal"] .cloc-total-final {
    background: transparent;
    border-top: 2px solid var(--cloc-total-gray-200);
    margin: 15px 0 0;
    padding: 15px 0 0;
}

/* ========================================
   Styles alternatifs (detailed)
   ======================================== */
.cloc-total-wrapper[data-style="detailed"] .cloc-total-box {
    border: 3px solid var(--cloc-total-primary);
}

.cloc-total-wrapper[data-style="detailed"] .cloc-total-line {
    border-bottom: 1px solid var(--cloc-total-gray-100);
}

.cloc-total-wrapper[data-style="detailed"] .cloc-line-detail {
    background: var(--cloc-total-primary);
    color: white;
    font-weight: 600;
}

/* ========================================
   Animations supplémentaires
   ======================================== */
.cloc-total-rental,
.cloc-total-insurance,
.cloc-total-transport {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Effet de surbrillance lors de la mise à jour */
.cloc-value-updated {
    animation: highlight 0.5s ease-out;
}

@keyframes highlight {
    0% {
        background: rgba(139, 92, 246, 0.3);
        transform: scale(1.05);
    }
    100% {
        background: transparent;
        transform: scale(1);
    }
}

/* ========================================
   Intégration WooCommerce
   ======================================== */
.woocommerce .cloc-total-wrapper {
    clear: both;
    margin: 30px 0;
}

.woocommerce-page .cloc-total-box {
    margin-bottom: 20px;
}

/* Positionnement après le formulaire d'ajout au panier */
.cart .cloc-total-wrapper,
form.cart + .cloc-total-wrapper {
    margin-top: 30px;
}

/* ========================================
   Mode sombre (optionnel)
   ======================================== */
@media (prefers-color-scheme: dark) {
    .cloc-total-box {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
    }
    
    .cloc-line-text,
    .cloc-total-line-value {
        color: #f3f4f6;
    }
    
    .cloc-line-detail {
        background: #374151;
        color: #d1d5db;
    }
    
    .cloc-total-final {
        background: #111827;
    }
    
    .cloc-total-empty {
        background: #1f2937;
        border-color: #374151;
        color: #9ca3af;
    }
}
