/* Calendário Financeiro */
.financial-calendar {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 100%;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.calendar-month-year {
    display: flex;
    gap: 0.3rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.calendar-nav-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-nav-btn:hover {
    background: var(--accent-color);
    transform: scale(1.1);
}

.calendar-today-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-today-btn:hover {
    background: #b30727;
    transform: translateY(-2px);
}

.calendar-add-btn {
    background: rgba(255, 140, 0, 1);
    color: white;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.calendar-add-btn:hover {
    background: rgba(255, 120, 0, 1);
    transform: scale(1.1);
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 0.4rem;
}

.calendar-weekday {
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: #666;
    padding: 0.5rem 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 1px solid #e9ecef;
    background: #fff;
}

.calendar-day.other-month {
    color: #ccc;
    background: #f8f9fa;
    cursor: default;
}

.calendar-day.today {
    border: 2px solid var(--primary-color);
    font-weight: 700;
}

.calendar-day.has-event {
    font-weight: 600;
    border-width: 2px;
}

.calendar-day:not(.other-month):hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.day-number {
    position: relative;
    z-index: 2;
}

.event-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 250px;
    max-width: 300px;
    text-align: left;
}

.calendar-day:hover .event-tooltip {
    display: block;
}

.event-tooltip-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.4;
    position: relative;
}

.event-tooltip-item:last-child {
    margin-bottom: 0;
}

.event-content {
    flex: 1;
}

.event-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.edit-event-btn,
.delete-event-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.edit-event-btn {
    background: #007bff;
}

.edit-event-btn:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.delete-event-btn {
    background: #dc3545;
}

.delete-event-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.event-tooltip-item strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Modal para adicionar evento */
.calendar-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.calendar-modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calendar-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.calendar-modal-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.calendar-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.calendar-modal-close:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.calendar-modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.calendar-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.btn-cancel,
.btn-save,
.btn-delete {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn-cancel {
    background: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background: #5a6268;
}

.btn-save {
    background: #28a745;
    color: white;
}

.btn-save:hover {
    background: #218838;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

/* Responsividade */
@media (max-width: 768px) {
    .financial-calendar {
        padding: 1rem;
    }

    .calendar-header {
        font-size: 1rem;
    }

    .calendar-month-year {
        font-size: 0.9rem;
    }

    .calendar-nav-btn {
        width: 24px;
        height: 24px;
    }

    .calendar-today-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .calendar-day {
        font-size: 0.8rem;
    }

    .event-tooltip {
        min-width: 200px;
        font-size: 0.8rem;
    }

    .calendar-legend {
        gap: 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .calendar-weekday {
        font-size: 0.75rem;
        padding: 0.3rem 0;
    }

    .calendar-day {
        font-size: 0.75rem;
    }

    .calendar-days {
        gap: 2px;
    }

    .event-tooltip {
        min-width: auto;
        max-width: none;
    }
}

/* ========================================
   WIDGET DE PRÓXIMOS VENCIMENTOS
   ======================================== */

.widget-proximos-vencimentos {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px var(--shadow-color);
    max-width: 500px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.widget-proximos-vencimentos:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-color);
    border: 1px solid var(--primary-color);
}

.widget-proximos-vencimentos h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    text-align: center;
}

#lista-proximos-vencimentos {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    flex-grow: 1;
}

#lista-proximos-vencimentos::-webkit-scrollbar {
    width: 6px;
}

#lista-proximos-vencimentos::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#lista-proximos-vencimentos::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

#lista-proximos-vencimentos::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.item-vencimento {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    margin-bottom: 0.6rem;
    border-left: 4px solid;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.item-vencimento:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #ffffff;
}

.vencimento-icone {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 30px;
    text-align: center;
}

.vencimento-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex-grow: 1;
}

.vencimento-data {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

.vencimento-titulo {
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.3;
}

.loading-message,
.no-events-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.btn-ver-calendario {
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-ver-calendario:hover {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-ver-calendario:active {
    transform: translateY(0);
}

.btn-ver-calendario i {
    font-size: 1.1rem;
}

/* ========================================
   MODAL DO CALENDÁRIO COMPLETO
   ======================================== */

.calendario-modal {
    border: none;
    border-radius: 16px;
    padding: 0;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    /* Centralização do modal */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.calendario-modal::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: backdropFadeIn 0.3s ease;
}

@keyframes backdropFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-header-calendario {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    color: white;
}

.modal-header-calendario h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.modal-close-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.modal-close-btn:hover {
    background: #c82333;
    transform: rotate(90deg) scale(1.1);
}

.modal-body-calendario {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 100px);
    background: #f8f9fa;
}

.modal-body-calendario::-webkit-scrollbar {
    width: 8px;
}

.modal-body-calendario::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-body-calendario::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-body-calendario::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* ========================================
   TOAST DE NOTIFICAÇÃO
   ======================================== */

.toast-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: white;
    border-left: 5px solid #ff9800;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 350px;
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
    animation: shake 0.5s ease 0.4s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toast-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.toast-content p {
    margin: 0;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    flex-grow: 1;
}

.toast-close {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.toast-close:hover {
    background: #5a6268;
    transform: scale(1.1);
}

/* ========================================
   RESPONSIVIDADE - WIDGET, MODAL E TOAST
   ======================================== */

@media (max-width: 768px) {
    .widget-proximos-vencimentos {
        max-width: 100%;
    }

    .calendario-modal {
        max-width: 95vw;
        max-height: 95vh;
    }

    .modal-header-calendario {
        padding: 1rem 1.5rem;
    }

    .modal-header-calendario h2 {
        font-size: 1.2rem;
    }

    .modal-body-calendario {
        padding: 1rem;
    }

    .toast-notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-150px);
    }

    .toast-notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .item-vencimento {
        padding: 0.6rem;
    }

    .vencimento-icone {
        font-size: 1.2rem;
        width: 25px;
    }

    .vencimento-data {
        font-size: 0.75rem;
    }

    .vencimento-titulo {
        font-size: 0.85rem;
    }

    .btn-ver-calendario {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }

    .toast-content {
        gap: 0.5rem;
    }

    .toast-icon {
        font-size: 1.5rem;
    }

    .toast-content p {
        font-size: 0.85rem;
    }
}