/* ========================================
   CALENDRIER DE PAIEMENTS - STYLES
   ======================================== */

/* Conteneur principal du calendrier - Ajouter du padding */
#calendar-tab {
    padding: 0 20px 20px 20px;
}

/* Header du calendrier */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.calendar-header h2 {
    margin: 0;
    color: #2c3e50;
}

.calendar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Alertes calendrier */
.calendar-alerts {
    margin-bottom: 20px;
}

.calendar-alerts .alert ul {
    margin: 10px 0 0 20px;
    padding: 0;
}

/* Statistiques rapides */
.calendar-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.calendar-stats-grid .stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.calendar-stats-grid .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.calendar-stats-grid .stat-icon.bg-warning {
    background: #f39c12;
}

.calendar-stats-grid .stat-icon.bg-danger {
    background: #e74c3c;
}

.calendar-stats-grid .stat-icon.bg-success {
    background: #27ae60;
}

.calendar-stats-grid .stat-icon.bg-info {
    background: #3498db;
}

.calendar-stats-grid .stat-info h4 {
    margin: 0;
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
}

.calendar-stats-grid .stat-info p {
    margin: 5px 0;
    color: #7f8c8d;
    font-size: 14px;
}

.calendar-stats-grid .stat-info small {
    color: #95a5a6;
    font-size: 12px;
}

/* Navigation calendrier */
.calendar-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calendar-navigation h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
}

/* Filtres */
.calendar-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.calendar-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-filters label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0;
}

.calendar-filters select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Vue Calendrier - Grille */
.calendar-grid-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calendar-grid {
    display: flex;
    flex-direction: column;
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #ecf0f1;
    padding: 10px 0;
    margin-bottom: 1px;
}

.calendar-day-header {
    text-align: center;
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
    padding: 8px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #ecf0f1;
}

.calendar-day {
    min-height: 100px;
    background: white;
    padding: 8px;
    position: relative;
    border: 1px solid #ecf0f1;
    transition: all 0.2s;
}

.calendar-day:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.calendar-day.empty {
    background: #f8f9fa;
}

.calendar-day.today {
    background: #ebf5fb;
    border: 2px solid #3498db;
}

.calendar-day.has-payments {
    background: #fffef0;
}

.calendar-day-number {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 14px;
}

.calendar-day-payments {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.calendar-payment {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s;
}

.calendar-payment:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Codes couleur par type de paiement */
.calendar-payment.income {
    background: #d5f4e6;
    border-left: 3px solid #27ae60;
    color: #27ae60;
}

.calendar-payment.expense {
    background: #fadbd8;
    border-left: 3px solid #e74c3c;
    color: #e74c3c;
}

.calendar-payment.invoice {
    background: #d6eaf8;
    border-left: 3px solid #3498db;
    color: #3498db;
}

.calendar-payment.tax_payment {
    background: #fcf3cf;
    border-left: 3px solid #f39c12;
    color: #f39c12;
}

.calendar-payment.custom {
    background: #e8daef;
    border-left: 3px solid #9b59b6;
    color: #9b59b6;
}

/* Statuts */
.calendar-payment.status-overdue,
tr.status-overdue {
    background: #f8d7da !important;
    font-weight: bold;
}

.calendar-payment.status-urgent {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.calendar-payment.status-paid {
    opacity: 0.6;
    text-decoration: line-through;
}

/* Vue Liste */
.calendar-list-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d5f4e6;
    color: #27ae60;
}

.badge-danger {
    background: #fadbd8;
    color: #e74c3c;
}

.badge-warning {
    background: #fcf3cf;
    color: #f39c12;
}

.badge-info {
    background: #d6eaf8;
    color: #3498db;
}

.badge-secondary {
    background: #e8daef;
    color: #7f8c8d;
}

.badge-orange {
    background: #ffe5cc;
    color: #e67e22;
}

/* Modal paiement */
#paymentModal .modal-content {
    max-width: 700px;
}

#paymentForm .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

#recurrenceFields {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-top: 10px;
}

/* Modals personnalisés pour le calendrier */
#calendarConfirmModal,
#calendarPromptModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#calendarConfirmModal .modal-content,
#calendarPromptModal .modal-content {
    max-width: 450px;
    width: 90%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.2s ease-out;
}

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

#calendarConfirmModal .modal-header,
#calendarPromptModal .modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#calendarConfirmModal .modal-header h3,
#calendarPromptModal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
    font-weight: 600;
    flex: 1;
}

#calendarConfirmModal .close-modal,
#calendarPromptModal .close-modal {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

#calendarConfirmModal .close-modal:hover,
#calendarPromptModal .close-modal:hover {
    color: #333;
}

#calendarConfirmModal .modal-body,
#calendarPromptModal .modal-body {
    padding: 20px;
}

#calendarConfirmModal .modal-body p,
#calendarPromptModal .modal-body p {
    margin: 0 0 15px 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

#calendarConfirmModal .modal-footer,
#calendarPromptModal .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

#calendarPromptInput {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

#calendarPromptInput:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    #calendar-tab {
        padding: 0 10px 20px 10px;
    }

    .calendar-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .calendar-stats-grid {
        grid-template-columns: 1fr;
    }

    /* Modals plus petits sur mobile */
    #calendarConfirmModal .modal-content,
    #calendarPromptModal .modal-content {
        max-width: 95%;
        margin: 0 10px;
    }

    #calendarConfirmModal .modal-header h3,
    #calendarPromptModal .modal-header h3 {
        font-size: 16px;
    }

    #calendarConfirmModal .modal-body,
    #calendarPromptModal .modal-body {
        padding: 15px;
    }

    #calendarConfirmModal .modal-footer,
    #calendarPromptModal .modal-footer {
        padding: 12px 15px;
        flex-wrap: wrap;
    }

    #calendarConfirmModal .modal-footer button,
    #calendarPromptModal .modal-footer button {
        flex: 1;
        min-width: 100px;
    }

    .calendar-day {
        min-height: 80px;
        font-size: 12px;
    }

    .calendar-day-payments {
        gap: 2px;
    }

    .calendar-payment {
        font-size: 10px;
        padding: 2px 4px;
    }

    .calendar-filters {
        flex-direction: column;
        gap: 10px;
    }

    .calendar-filters .filter-group {
        width: 100%;
    }

    .calendar-filters select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .calendar-days {
        font-size: 11px;
    }

    .calendar-day {
        min-height: 60px;
        padding: 4px;
    }

    .calendar-day-number {
        font-size: 12px;
    }

    .calendar-payment {
        font-size: 9px;
    }
}
