/* Custom CSS for Cash Flow Manager */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #ecf0f1;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --light-color: #f8f9fa;
    --dark-color: #2c3e50;
    --muted-color: #6c757d;
    
    /* Neutral color palette */
    --beige: #f5f5dc;
    --soft-white: #fefefe;
    --charcoal: #36454f;
}

/* Fix tooltip z-index to appear above modals */
.tooltip {
    z-index: 9999 !important;
}

.tooltip-inner {
    max-width: 300px;
    text-align: left;
    line-height: 1.5;
}

/* Tooltip link styling */
.tooltip-inner a {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
    transition: opacity 0.2s ease;
    pointer-events: auto;
    cursor: pointer;
}

.tooltip-inner a:hover {
    opacity: 0.85;
}

/* Enable pointer events on tooltips so links are clickable */
.tooltip {
    pointer-events: auto;
}

.tooltip .tooltip-inner {
    pointer-events: auto;
}

/* Ensure Bootstrap tooltips appear above all modals */
.bs-tooltip-auto[data-popper-placement^="top"],
.bs-tooltip-top {
    z-index: 9999 !important;
}

.bs-tooltip-auto[data-popper-placement^="bottom"],
.bs-tooltip-bottom {
    z-index: 9999 !important;
}

/* Body and general styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to bottom, #f7f8fa 0%, #ffffff 100%);
    color: var(--charcoal);
    line-height: 1.6;
    min-height: 100vh;
}

/* Tab subline styling */
.tab-subline {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-top: 0.25rem;
    color: var(--muted-color);
}

@media (max-width: 768px) {
    .tab-subline {
        font-size: 0.85rem;
    }
}

/* Navigation */
.navbar {
    background-color: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
}

.navbar-brand {
    color: var(--primary-color) !important;
    font-size: 1.5rem;
}

/* Brand Lockup Styling */
.brand-lockup {
    text-decoration: none;
    transition: opacity 0.2s ease;
    padding: 0;
}

.brand-lockup:hover {
    opacity: 0.8;
}

.brand-lockup:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 4px;
    border-radius: 4px;
}

.brand-icon {
    font-size: 26px;
    color: #212B36;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    gap: 4px;
}

.brand-title {
    font-size: 22px;
    font-weight: 600;
    color: #212B36;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.brand-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: #6B7783;
    white-space: nowrap;
}

/* Responsive adjustments for brand lockup */
@media (max-width: 1024px) {
    .brand-title {
        font-size: 20px;
    }
    .brand-subtitle {
        font-size: 13px;
    }
    .brand-icon {
        font-size: 24px;
    }
}

@media (max-width: 640px) {
    .brand-subtitle {
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }
    .brand-title {
        font-size: 18px;
    }
    .brand-icon {
        font-size: 22px;
    }
}

.nav-link {
    color: var(--charcoal) !important;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Login Card Styling */
#loginCard {
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
    border-radius: 12px;
}

/* Dashboard Controls Panel */
.dashboard-controls {
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 6px 24px rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px;
}

/* Dashboard Module Cards (Daily Cash Balance, Daily Cash Flow) */
.dashboard-module {
    background-color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 6px 24px rgba(0, 0, 0, 0.1) !important;
}

/* Summary Cards - Reduced shadows */
.summary-card {
    background-color: #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.dashboard-controls .card-body {
    position: relative;
}

.dashboard-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--info-color), var(--primary-color));
    border-radius: 12px 12px 0 0;
}

/* Helper text styling */
.form-helper {
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
}

.card-header {
    background-color: var(--beige);
    border-bottom: 1px solid var(--secondary-color);
    border-radius: 10px 10px 0 0 !important;
    padding: 1rem 1.25rem;
}

.card-header-primary {
    background-color: var(--primary-color) !important;
    border-bottom: 1px solid var(--primary-color);
}

.card-title {
    color: var(--charcoal);
    font-weight: 600;
}

/* Metric cards on dashboard */
.metric-card {
    background: linear-gradient(135deg, var(--soft-white) 0%, var(--beige) 100%);
    border-left: 4px solid var(--primary-color);
}

.metric-card:hover {
    border-left-color: var(--success-color);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #34495e;
    border-color: #34495e;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
}

/* Tables */
.table {
    background-color: var(--soft-white);
}

.table thead th {
    background-color: var(--beige);
    border-bottom: 2px solid var(--secondary-color);
    color: var(--charcoal);
    font-weight: 600;
}

.sticky-header-table tbody tr {
    border-bottom: 1px solid #e9ecef;
}

.sticky-header-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.sticky-header-table tbody tr:hover {
    background-color: #e3f2fd !important;
    transition: background-color 0.15s ease;
}

.sticky-header-table tbody td {
    vertical-align: middle;
    padding: 8px 12px;
}

.table-hover tbody tr:hover {
    background-color: var(--beige);
}

/* Sortable table styles */
.table thead th.sortable {
    transition: background-color 0.2s ease;
}

.table thead th.sortable:hover {
    background-color: var(--secondary-color);
    color: var(--soft-white);
}

.table thead th .sort-icon {
    font-size: 0.8em;
    transition: opacity 0.2s ease;
}

.sticky-header-table thead th.sortable:hover {
    background-color: var(--secondary-color);
    color: var(--soft-white);
}

/* Compact table styles for Credit Cards */
.compact-table thead th {
    background-color: #f5f5f5;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    vertical-align: middle;
    padding: 12px 12px;
}

.compact-table tbody tr {
    border-bottom: 1px solid #e9ecef;
}

.compact-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.compact-table tbody tr:hover {
    background-color: #e3f2fd !important;
    transition: background-color 0.15s ease;
}

.compact-table tbody td {
    vertical-align: middle;
    padding: 8px 12px;
}

/* Sticky header table styles */
.sticky-header-table-container {
    max-height: 550px;
    overflow: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sticky-header-table {
    margin-bottom: 0;
}

.sticky-header-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f5f5f5;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    vertical-align: middle;
    padding: 12px 12px;
}

/* Ensure tooltips appear above sticky headers */
.tooltip {
    z-index: 1050 !important;
}

/* Financial color coding */
.text-success, .text-positive {
    color: var(--success-color) !important;
}

.text-danger, .text-negative {
    color: var(--danger-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

/* Badges */
.badge {
    font-weight: 500;
    border-radius: 6px;
}

/* Forms */
.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #ddd;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(44, 62, 80, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--charcoal);
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
}

.alert-success {
    background-color: rgba(39, 174, 96, 0.1);
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.1);
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: rgba(243, 156, 18, 0.1);
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background-color: rgba(52, 152, 219, 0.1);
    color: #0c5460;
    border-left: 4px solid var(--info-color);
}

/* Progress bars */
.progress {
    height: 10px;
    border-radius: 5px;
    background-color: var(--secondary-color);
}

.progress-bar {
    border-radius: 5px;
}

/* Payoff Progress Bar - Enhanced visibility */
.payoff-progress {
    height: 22px;
    border-radius: 6px;
    background-color: #d8d8d8; /* Darker neutral background for better contrast */
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); /* Subtle inner shadow for depth */
    overflow: hidden;
}

.payoff-progress .progress-bar {
    background-color: #3b82f6; /* Brighter blue for better visibility */
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: width 0.3s ease;
}

.payoff-progress .progress-bar.bg-success {
    background-color: #10b981; /* Green for fully paid */
}

/* Dynamic text color for low progress */
.payoff-progress .progress-bar.low-progress {
    color: #374151; /* Dark gray text for better readability at <10% */
}

/* Modals */
.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    background-color: #fff;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 20px;
}

.modal-title {
    color: #495057;
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-body {
    padding: 20px;
}

.modal-body .mb-3 {
    margin-bottom: 1rem !important;
}

.modal-body .form-label {
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #dee2e6;
}

/* Footer */
footer {
    background-color: #ffffff !important;
    color: var(--muted-color);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Chart containers */
canvas {
    max-height: 300px;
}

/* Empty states */
.opacity-25 {
    opacity: 0.25;
}

.opacity-50 {
    opacity: 0.5;
}

/* Dashboard summary cards adaptive font sizing - only for currency amounts */
.adaptive-currency {
    font-size: clamp(0.75rem, 1.5vw, 1.1rem) !important;
    white-space: nowrap;
    line-height: 1.2;
    max-width: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .metric-card {
        margin-bottom: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    /* Smaller font scaling on mobile for adaptive currency */
    .adaptive-currency {
        font-size: clamp(0.6rem, 3vw, 0.9rem) !important;
    }
}

@media (max-width: 576px) {
    /* Extra small screens - very conservative font sizing */
    .adaptive-currency {
        font-size: clamp(0.5rem, 2.8vw, 0.8rem) !important;
    }
}

/* Large screens - still conservative to prevent overflow */
@media (min-width: 992px) {
    .adaptive-currency {
        font-size: clamp(0.9rem, 1.3vw, 1.25rem) !important;
    }
}

/* Custom utilities */
.text-muted {
    color: var(--muted-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.border-success {
    border-color: var(--success-color) !important;
}

.border-danger {
    border-color: var(--danger-color) !important;
}

/* Smooth transitions */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-color);
}

::-webkit-scrollbar-thumb {
    background: var(--muted-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Stepper highlight animations */
@keyframes highlightPulse {
    0%, 100% {
        background-color: transparent;
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
    50% {
        background-color: rgba(13, 110, 253, 0.1);
        box-shadow: 0 0 20px 5px rgba(13, 110, 253, 0.3);
    }
}

.highlight-pulse {
    animation: highlightPulse 1.5s ease-in-out 2;
    border-radius: 8px;
}

/* Nav tab highlight */
@keyframes navGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
    50% {
        box-shadow: 0 0 15px 3px rgba(13, 110, 253, 0.6);
    }
}

.nav-highlight {
    animation: navGlow 1s ease-in-out 3;
    border-radius: 6px;
}

/* Step 3 Modal Guide Cards */
.guide-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.guide-card:hover {
    transform: translateY(-5px) scale(1.05);
}

.guide-card .card {
    transition: all 0.3s ease;
}

.guide-card:hover .card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
    border: 2px solid var(--bs-primary) !important;
}

.guide-icon-wrapper {
    transition: transform 0.3s ease;
}

.guide-card:hover .guide-icon-wrapper {
    transform: scale(1.2);
}

/* Modal backdrop style */
.modal-backdrop.show {
    opacity: 0.7;
}

/* Stepper step hover */
.stepper-step:hover {
    opacity: 0.8;
}

/* Stepper responsive design */
.stepper-container {
    width: 100%;
}

/* On smaller screens, make text more compact */
@media (max-width: 768px) {
    .stepper-text {
        font-size: 0.75rem !important;
    }
    
    .stepper-arrow {
        font-size: 0.8rem;
    }
    
    .stepper-container {
        padding: 0.5rem 0.75rem !important;
    }
}

/* On very small screens, hide arrows and stack vertically if needed */
@media (max-width: 576px) {
    .stepper-container {
        flex-wrap: wrap;
        justify-content: center !important;
        gap: 0.5rem;
    }
    
    .stepper-arrow {
        display: none;
    }
    
    .stepper-step {
        margin: 0.25rem;
    }
}

/* Custom CSS Tooltip */
.info-tooltip {
    position: relative;
    display: inline-block;
}

.info-tooltip .tooltip-text {
    visibility: hidden;
    width: 300px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1060;
    bottom: 125%;
    left: 50%;
    margin-left: -150px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    line-height: 1.4;
}

.info-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.info-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Credit Card Header Button Styling */
.card-header-btn.btn-outline-light {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.5);
}

.card-header-btn.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
    color: #fff !important;
}

.card-header-btn.btn-outline-light:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.card-header-btn.btn-outline-light:disabled {
    opacity: 0.5;
    color: #fff !important;
}

/* Expanded Statement Panel Styling */
.expanded-statement-panel {
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}
