/* ============================================================================ */
/* CSS for MondialRelay module                                                 */
/* Copyright (C) 2025 Massaoud <massaoud@dzprod.net>                          */
/* ============================================================================ */

/* ============================================================================ */
/* Widget Point Relais                                                         */
/* ============================================================================ */

.mondialrelay-widget-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
}

.mondialrelay-widget-container h3 {
    margin-top: 0;
    color: #495057;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

#Zone_Widget {
    min-height: 400px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    margin: 10px 0;
}

/* Styles pour le widget Mondial Relay */
.mr-widget-container {
    font-family: Arial, sans-serif;
}

.mr-widget-map {
    border-radius: 4px;
}

.mr-widget-list {
    max-height: 300px;
    overflow-y: auto;
}

.mr-widget-point {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin: 5px 0;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.mr-widget-point:hover {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.mr-widget-point.selected {
    background-color: #c8e6c9;
    border-color: #4caf50;
}

/* ============================================================================ */
/* Informations expédition                                                     */
/* ============================================================================ */

.mondialrelay-expedition-info {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mondialrelay-expedition-info h3 {
    margin-top: 0;
    color: #495057;
    font-size: 18px;
    border-bottom: 2px solid #28a745;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.mondialrelay-point-relais-info {
    background: #f8f9fa;
    border-left: 4px solid #17a2b8;
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 0 4px 4px 0;
}

.mondialrelay-point-relais-info strong {
    color: #495057;
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

.mondialrelay-point-relais-info em {
    color: #6c757d;
    font-style: italic;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: #28a745;
}

.badge-info {
    background-color: #17a2b8;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-danger {
    background-color: #dc3545;
}

.badge-secondary {
    background-color: #6c757d;
}

.badge-primary {
    background-color: #007bff;
}

/* ============================================================================ */
/* Timeline de suivi                                                           */
/* ============================================================================ */

.timeline-container {
    position: relative;
    padding: 20px 0;
    margin: 20px 0;
}

.timeline-item {
    position: relative;
    padding: 0 0 30px 60px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.timeline-item.current {
    opacity: 1;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.timeline-line {
    position: absolute;
    left: 19px;
    top: 40px;
    width: 2px;
    height: 30px;
    background-color: #dee2e6;
    z-index: 1;
}

.timeline-content {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 3px solid #dee2e6;
}

.timeline-item.current .timeline-content {
    border-left-color: #28a745;
    background: #f8fff9;
}

.timeline-content h4 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

.timeline-content p {
    margin: 0 0 8px 0;
    color: #6c757d;
    line-height: 1.4;
}

.timeline-content small {
    color: #868e96;
    font-size: 0.85em;
}

/* ============================================================================ */
/* Boutons d'action                                                            */
/* ============================================================================ */

.mondialrelay-actions {
    margin: 20px 0;
    text-align: center;
}

.mondialrelay-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin: 0 5px;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.mondialrelay-button:hover {
    background-color: #0056b3;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.mondialrelay-button.success {
    background-color: #28a745;
}

.mondialrelay-button.success:hover {
    background-color: #1e7e34;
}

.mondialrelay-button.warning {
    background-color: #ffc107;
    color: #212529;
}

.mondialrelay-button.warning:hover {
    background-color: #e0a800;
    color: #212529;
}

.mondialrelay-button.danger {
    background-color: #dc3545;
}

.mondialrelay-button.danger:hover {
    background-color: #c82333;
}

/* ============================================================================ */
/* Listes et tableaux                                                          */
/* ============================================================================ */

.mondialrelay-list-stats {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.mondialrelay-list-stats h4 {
    margin-top: 0;
    color: #495057;
    font-size: 16px;
}

.mondialrelay-stat-item {
    display: inline-block;
    text-align: center;
    margin: 10px 15px;
    min-width: 80px;
}

.mondialrelay-stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
    display: block;
}

.mondialrelay-stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Table responsive améliorée */
.mondialrelay-table-container {
    overflow-x: auto;
    margin: 15px 0;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mondialrelay-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.mondialrelay-table th,
.mondialrelay-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.mondialrelay-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
}

.mondialrelay-table tbody tr:hover {
    background-color: #f5f5f5;
}

/* ============================================================================ */
/* Alertes et messages                                                         */
/* ============================================================================ */

.mondialrelay-alert {
    padding: 12px 16px;
    margin: 15px 0;
    border: 1px solid transparent;
    border-radius: 4px;
    position: relative;
}

.mondialrelay-alert.info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.mondialrelay-alert.success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.mondialrelay-alert.warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.mondialrelay-alert.error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.mondialrelay-alert strong {
    font-weight: 600;
}

/* ============================================================================ */
/* Configuration et administration                                              */
/* ============================================================================ */

.mondialrelay-config-section {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin: 20px 0;
    overflow: hidden;
}

.mondialrelay-config-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.mondialrelay-config-content {
    padding: 20px;
}

.mondialrelay-config-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f8f9fa;
}

.mondialrelay-config-row:last-child {
    border-bottom: none;
}

.mondialrelay-config-label {
    flex: 0 0 200px;
    font-weight: 500;
    color: #495057;
}

.mondialrelay-config-value {
    flex: 1;
}

/* ============================================================================ */
/* Responsive design                                                           */
/* ============================================================================ */

@media (max-width: 768px) {
    .mondialrelay-expedition-info {
        padding: 15px;
        margin: 10px 0;
    }
    
    .timeline-item {
        padding: 0 0 25px 50px;
    }
    
    .timeline-marker {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .timeline-line {
        left: 14px;
        top: 30px;
        height: 25px;
    }
    
    .timeline-content {
        padding: 12px;
    }
    
    .timeline-content h4 {
        font-size: 14px;
    }
    
    .mondialrelay-stat-item {
        margin: 5px 10px;
        min-width: 60px;
    }
    
    .mondialrelay-stat-number {
        font-size: 20px;
    }
    
    .mondialrelay-button {
        padding: 8px 16px;
        margin: 2px;
        font-size: 14px;
    }
    
    .mondialrelay-config-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mondialrelay-config-label {
        flex: none;
        margin-bottom: 5px;
        font-weight: 600;
    }
    
    .mondialrelay-config-value {
        width: 100%;
    }
    
    #Zone_Widget {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .mondialrelay-widget-container {
        padding: 10px;
        margin: 10px 0;
    }
    
    .mondialrelay-expedition-info {
        padding: 10px;
    }
    
    .mondialrelay-point-relais-info {
        padding: 8px 10px;
    }
    
    .timeline-item {
        padding: 0 0 20px 40px;
    }
    
    .timeline-marker {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    .timeline-line {
        left: 12px;
        top: 25px;
        height: 20px;
    }
    
    .badge {
        font-size: 0.65em;
        padding: 0.25em 0.5em;
    }
}

/* ============================================================================ */
/* Animations et transitions                                                   */
/* ============================================================================ */

.mondialrelay-fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mondialrelay-slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.mondialrelay-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ============================================================================ */
/* États de chargement                                                         */
/* ============================================================================ */

.mondialrelay-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mondialrelay-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================================ */
/* Utilitaires                                                                 */
/* ============================================================================ */

.mondialrelay-text-center { text-align: center; }
.mondialrelay-text-right { text-align: right; }
.mondialrelay-text-left { text-align: left; }

.mondialrelay-mt-1 { margin-top: 0.25rem; }
.mondialrelay-mt-2 { margin-top: 0.5rem; }
.mondialrelay-mt-3 { margin-top: 1rem; }
.mondialrelay-mt-4 { margin-top: 1.5rem; }
.mondialrelay-mt-5 { margin-top: 3rem; }

.mondialrelay-mb-1 { margin-bottom: 0.25rem; }
.mondialrelay-mb-2 { margin-bottom: 0.5rem; }
.mondialrelay-mb-3 { margin-bottom: 1rem; }
.mondialrelay-mb-4 { margin-bottom: 1.5rem; }
.mondialrelay-mb-5 { margin-bottom: 3rem; }

.mondialrelay-p-1 { padding: 0.25rem; }
.mondialrelay-p-2 { padding: 0.5rem; }
.mondialrelay-p-3 { padding: 1rem; }
.mondialrelay-p-4 { padding: 1.5rem; }
.mondialrelay-p-5 { padding: 3rem; }

.mondialrelay-d-none { display: none; }
.mondialrelay-d-block { display: block; }
.mondialrelay-d-inline { display: inline; }
.mondialrelay-d-inline-block { display: inline-block; }
.mondialrelay-d-flex { display: flex; }

.mondialrelay-justify-center { justify-content: center; }
.mondialrelay-justify-between { justify-content: space-between; }
.mondialrelay-justify-around { justify-content: space-around; }

.mondialrelay-align-center { align-items: center; }
.mondialrelay-align-start { align-items: flex-start; }
.mondialrelay-align-end { align-items: flex-end; }

.mondialrelay-w-100 { width: 100%; }
.mondialrelay-h-100 { height: 100%; }

.mondialrelay-opacity-50 { opacity: 0.5; }
.mondialrelay-opacity-75 { opacity: 0.75; }

.mondialrelay-shadow-sm {
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

.mondialrelay-shadow {
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}

.mondialrelay-shadow-lg {
    box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
}

.mondialrelay-rounded { border-radius: 4px; }
.mondialrelay-rounded-lg { border-radius: 8px; }

.mondialrelay-border { border: 1px solid #dee2e6; }
.mondialrelay-border-primary { border-color: #007bff; }
.mondialrelay-border-success { border-color: #28a745; }
.mondialrelay-border-warning { border-color: #ffc107; }
.mondialrelay-border-danger { border-color: #dc3545; }

/* ============================================================================ */
/* Mode sombre (dark mode)                                                     */
/* ============================================================================ */

@media (prefers-color-scheme: dark) {
    .mondialrelay-expedition-info {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .mondialrelay-expedition-info h3 {
        color: #e2e8f0;
        border-bottom-color: #4299e1;
    }
    
    .mondialrelay-point-relais-info {
        background: #4a5568;
        border-left-color: #4299e1;
        color: #e2e8f0;
    }
    
    .timeline-content {
        background: #2d3748;
        color: #e2e8f0;
        border-left-color: #4a5568;
    }
    
    .timeline-item.current .timeline-content {
        border-left-color: #48bb78;
        background: #2f4f4f;
    }
    
    .mondialrelay-config-section {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .mondialrelay-config-header {
        background: #4a5568;
        border-bottom-color: #2d3748;
        color: #e2e8f0;
    }
    
    .mondialrelay-table {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .mondialrelay-table th {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .mondialrelay-table tbody tr:hover {
        background-color: #4a5568;
    }
}

/* ============================================================================ */
/* Print styles                                                                */
/* ============================================================================ */

@media print {
    .mondialrelay-expedition-info {
        background: white !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .mondialrelay-button {
        display: none !important;
    }
    
    .timeline-marker {
        background: white !important;
        border: 2px solid #000 !important;
        color: #000 !important;
    }
    
    .timeline-content {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
    
    .badge {
        background: white !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }
}