/* ============= SAVED CALCULATIONS MODALS ============= */

/* Modal Overlay */
.modal-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
    pointer-events: auto !important;
}

/* Modal Dialog */
.modal-dialog {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    position: relative;
    z-index: 100000 !important;
    pointer-events: auto !important;
}

.modal-dialog.modal-large {
    max-width: 900px;
}

/* Modal Header */
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer !important;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    pointer-events: auto !important;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    position: relative;
    z-index: 100001 !important;
}

.modal-actions button {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.loading-state i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
    display: block;
}

.empty-state h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.empty-state p {
    margin: 0;
    font-size: 0.875rem;
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.dashboard-header span {
    font-weight: 600;
    color: var(--brand-primary);
}

/* Calculations Table */
.table-responsive {
    overflow-x: auto;
}

.calculations-table {
    width: 100%;
    border-collapse: collapse;
}

.calculations-table thead {
    background: var(--bg-secondary);
}

.calculations-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    border-bottom: 2px solid var(--border-color);
}

.calculations-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.calculations-table tbody tr {
    transition: background 0.2s ease;
}

.calculations-table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.5rem;
    min-width: auto;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon i {
    margin: 0;
}

/* Calculation Meta */
.calc-name {
    font-weight: 600;
    color: var(--text-primary);
}

.calc-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.calc-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}

.calc-amount {
    font-weight: 600;
    color: var(--brand-success);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Text */
.form-text {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-dialog {
        width: 95%;
        max-height: 95vh;
    }

    .modal-dialog.modal-large {
        max-width: 95%;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .calculations-table {
        font-size: 0.875rem;
    }

    .calculations-table th,
    .calculations-table td {
        padding: 0.5rem;
    }

    .table-actions {
        flex-direction: column;
    }
}