/* =================
   FINANCIAL APP - COMMON STYLES
   Common CSS for all pages in the financial management system
================= */

/* =================
   GLOBAL STYLES 
================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.4;
}

/* =================
   HEADER & NAVIGATION 
================= */
/* Standardized header CSS - add to ALL pages */
.header {
    background-color: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px; /* Consistent height */
    min-height: 60px;
}

.nav-tabs {
    display: flex;
    gap: 24px;
    flex: 1;
}

.nav-tab {
    padding: 12px 0;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-tab:hover {
    color: #1e293b;
    border-bottom-color: #059669;
}

.nav-tab.active {
    color: #059669;
    border-bottom-color: #059669;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 7px;
}

.user-greeting {
    color: #374151;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
}

.user-greeting .user-name {
    font-weight: 600;
    color: #059669;
}

.logout-btn {
    padding: 8px;
    background: white;
    color: #dc2626;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.logout-btn:hover {
    background: #dc2626;
    color: white;
}

.settings-btn {
    padding: 8px;
    background: white;
    color: #64748b;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    text-decoration: none;
}

.settings-btn:hover {
    color: #059669;
}

.settings-btn.active {
    color: #059669;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        height: auto;
        padding: 12px 0;
        gap: 12px;
    }
    
    .nav-tabs {
        flex: none;
        justify-content: center;
        gap: 16px;
    }
    
    .nav-tab {
        font-size: 13px;
        padding: 8px 0;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }
}

/* =================
   SUB NAVIGATION 
================= */
.sub-nav {
    background-color: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 24px;
}

.sub-nav-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    min-height: 48px;
}

.sub-nav-tabs {
    display: flex;
    gap: 32px;
    flex: 1;
}

.sub-nav-tab {
    padding: 12px 0;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.sub-nav-tab:hover {
    color: #1e293b;
}

.sub-nav-tab.active {
    color: #0ea5e9;
    border-bottom-color: #0ea5e9;
}

.sub-nav-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

/* =================
   BUTTONS 
================= */
.btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    background: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    background: white;
}

.btn-primary, .header-btn.btn-primary {
    color: #059669;
    border-color: #059669;
}

.btn-primary:hover, .header-btn.btn-primary:hover {
    background-color: #059669;
    color: white;
}

.btn-secondary, .header-btn.btn-secondary {
    color: #6b7280;
    border-color: #d1d5db;
}

.btn-secondary:hover, .header-btn.btn-secondary:hover {
    background-color: #374151;
    border-color: #374151;
    color: white;
}

.btn-secondary:disabled, .header-btn.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary:disabled:hover, .header-btn.btn-secondary:disabled:hover {
    background-color: white;
    border-color: #d1d5db;
    color: #6b7280;
}

.btn-add-item {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-item:before {
    content: '+';
    font-size: 1.2rem;
    font-weight: 700;
}

.btn-add-item:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.btn-export {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.btn-export:hover {
    background: #218838;
}

.btn-refresh {
    background: #17a2b8;
    color: white;
    border-color: #17a2b8;
}

.btn-refresh:hover {
    background: #138496;
}

/* Success Modal OK Button - matches Add Bank Account styling */
#successModal .btn-modal.btn-primary {
    background: white;
    color: #059669;
    border: 1px solid #059669;
}

#successModal .btn-modal.btn-primary:hover {
    background: #059669;
    color: white;
}

/* Center success message text */
#successMessage {
    text-align: center;
    margin: 20px 0;
}

/* Center modal actions for success modal */
#successModal .modal-actions {
    justify-content: center;
}

/* Standardize ALL modal buttons - consistent sizing and padding */
.modal .btn-modal,
.modal-overlay .btn-modal,
#successModal .btn-modal {
    padding: 8px 12px; /* Consistent padding for all popup buttons */
    flex: 0 0 auto; /* Don't grow or shrink, use content size */
    min-width: 80px; /* Minimum width for consistency */
    max-width: 120px; /* Maximum width to keep buttons reasonable */
    font-size: 14px; /* Consistent font size */
}

/* =================
   MAIN CONTENT 
================= */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.page-header {
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 6px;
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* =================
   CONTROLS & FILTERS 
================= */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    white-space: nowrap;
}

.quick-select {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-btn:hover {
    background: #e9ecef;
}

.quick-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.period-toggle-btn {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
    color: #6b7280;
    white-space: nowrap;
}

.period-toggle-btn:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.period-toggle-btn.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

select.date-input {
    background: white;
    cursor: pointer;
}

.view-options {
    display: flex;
    gap: 15px;
    align-items: center;
}

.radio-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
}

.radio-group label {
    font-size: 0.85rem;
    cursor: pointer;
}

/* =================
   FORMS 
================= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-control, .input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-control:focus, .input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.type-toggle {
    display: flex;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    background: white;
}

.type-toggle input[type="radio"] {
    display: none;
}

.toggle-label {
    flex: 1;
    padding: 12px 20px;
    text-align: center;
    cursor: pointer;
    background: #f8f9fa;
    color: #6c757d;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    margin: 0;
}

.type-toggle input[type="radio"]:checked + .toggle-label {
    background: #007bff;
    color: white;
}

.toggle-label:hover {
    background: #e9ecef;
}

.type-toggle input[type="radio"]:checked + .toggle-label:hover {
    background: #0056b3;
}

/* =================
   TABLES 
================= */
.table-container {
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
}

.table-title {
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
    font-size: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

tr:hover {
    background-color: #f8fafc;
}

.sortable-header {
    cursor: pointer;
    transition: background-color 0.2s;
}

.sortable-header:hover {
    background-color: #f1f5f9;
}

.sort-indicator {
    font-weight: normal;
    margin-left: 4px;
}

.sort-indicator.active {
    color: #059669;
}

/* =================
   MODALS 
================= */
.modal, .modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

/* Reduced padding for message modals */
#successModal .modal-content {
    padding: 20px 12px; /* 20px top/bottom, 12px left/right */
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
}

.modal-buttons, .modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center; /* Center the buttons */
    margin-top: 25px;
}

.modal-btn, .btn-modal {
    flex: 1;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    background: white;
    text-align: center;
}

.btn-confirm {
    color: #10b981;
    border-color: #10b981;
    background-color: white !important;
}

.btn-confirm:hover {
    background-color: #10b981 !important;
    color: white !important;
    border-color: #10b981 !important;
}

.btn-cancel {
    color: #6b7280;
    border-color: #d1d5db;
    background: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background: #545b62;
}

.btn-delete, .btn-danger, .header-btn.btn-danger {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-delete:hover, .btn-danger:hover, .header-btn.btn-danger:hover {
    background-color: #dc2626;
    color: white;
}

/* Confirmation dialog styling */
.confirmation-dialog .modal-content {
    font-size: 14px; /* Match button font size */
    font-weight: 400; /* Normal weight for better readability */
    padding: 20px; /* Adequate padding */
}

.confirmation-dialog .modal-title {
    font-size: 16px; /* Readable title size */
    font-weight: 500; /* Medium weight */
}

.confirmation-dialog #customConfirmMessage {
    font-size: 18px; /* Increased by 30% from 14px */
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    font-weight: normal; /* Ensure text is not bold */
    text-align: center; /* Center the message text */
    margin: 20px 0; /* Add some vertical spacing */
}

.confirmation-dialog #customConfirmMessage strong {
    font-weight: normal; /* Remove any bold formatting */
}

.confirmation-dialog .modal-actions {
    display: flex;
    justify-content: center !important; /* Force center alignment */
    align-items: center;
    gap: 12px;
    margin-top: 25px;
}

.confirmation-dialog .modal-btn, 
.confirmation-dialog .btn-modal {
    min-width: 100px;
    max-width: 140px;
    padding: 10px 16px; /* Slightly larger padding for better proportion */
    font-size: 14px; /* Increase button text size for better balance */
    flex: 0 0 auto; /* Don't grow or shrink, use content size */
}

.btn-primary.modal-btn, .btn-primary.btn-modal {
    background: white;
    color: #059669;
    border-color: #059669;
}

.btn-primary.modal-btn:hover, .btn-primary.btn-modal:hover {
    background: #059669;
    color: white;
}

/* =================
   CARDS & CONTAINERS 
================= */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-card, .summary-card {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card {
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid #e2e8f0;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-value, .card-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.card-value {
    font-size: 28px;
}

.stat-label, .card-subtitle {
    color: #6c757d;
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-content h3 {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 500;
}

.card-icon {
    font-size: 48px;
    opacity: 0.8;
}

/* =================
   UTILITY CLASSES 
================= */
.positive {
    color: #28a745;
    font-weight: 500;
}

.negative {
    color: #dc3545;
    font-weight: 500;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

/* =================
   RESPONSIVE 
================= */
@media (max-width: 1024px) {
    .sub-nav-content {
        flex-direction: column;
        gap: 12px;
        padding: 12px 24px;
    }
    
    .sub-nav-tabs {
        gap: 20px;
    }
    
    .sub-nav-actions {
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        height: auto;
        padding: 12px 0;
    }
    
    .nav-tabs {
        margin-bottom: 12px;
        gap: 16px;
    }
    
    .nav-tab {
        font-size: 13px;
        padding: 8px 0;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .quick-select {
        justify-content: center;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .sub-nav-actions .header-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}