/* ==========================================
   Bank Statement Processor — Premium Styles
   ========================================== */

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --success: #10B981;
    --success-light: #D1FAE5;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --warning: #F59E0B;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--gray-50) !important;
    color: var(--gray-800);
}

/* Navbar */
.custom-navbar {
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
}
.custom-navbar .navbar-brand {
    font-size: 1.25rem;
    color: var(--gray-800);
}
.custom-navbar .nav-link {
    font-weight: 500;
    color: var(--gray-700);
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: var(--transition);
}
.custom-navbar .nav-link:hover, .custom-navbar .nav-link.active {
    background-color: var(--primary-light);
    color: var(--primary) !important;
}

/* Cards */
.premium-card {
    background: #ffffff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    height: 100%;
}
.premium-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.card-header-glass {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

/* Metric Cards */
.metric-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.metric-icon.primary { background: var(--primary-light); color: var(--primary); }
.metric-icon.success { background: var(--success-light); color: var(--success); }
.metric-icon.danger { background: var(--danger-light); color: var(--danger); }
.metric-icon.warning { background: #FEF3C7; color: var(--warning); }
.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}
.metric-label {
    font-size: 0.875rem;
    color: var(--gray-700);
    font-weight: 500;
}

/* Forms */
.form-label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9rem;
}
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--gray-200);
    padding: 0.6rem 1rem;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}
.file-upload-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
    height: 100%;
}
.file-upload-btn {
    border: 2px dashed var(--gray-200);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    background: #FAFAFA;
    cursor: pointer;
    width: 100%;
}
.file-upload-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.file-upload-btn i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: var(--transition);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Status Pulse */
.status-pulse {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--success-light);
    color: var(--success);
}
.status-pulse::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-pulse.idle {
    background: var(--gray-200);
    color: var(--gray-700);
}
.status-pulse.idle::before {
    background: var(--gray-500);
    animation: none;
    box-shadow: none;
}

/* Status Badges */
.badge-custom {
    padding: 0.4em 0.8em;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-processing { background: var(--primary-light); color: var(--primary); }
.badge-warning { background: #FEF3C7; color: var(--warning); }

/* Tables */
.table-custom {
    margin-bottom: 0;
    /* required for position: sticky on th to work reliably - Bootstrap's
       default border-collapse: collapse breaks sticky table headers in
       most browsers */
    border-collapse: separate;
    border-spacing: 0;
}
.table-custom th {
    background-color: var(--gray-50);
    color: var(--gray-700);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-200);
    padding: 1rem;
    /* Keeps short headers like "Head 1"/"Head 2"/"Head 3" on one line -
       without this, uneven column widths can wrap one of them onto two
       lines while its neighbors stay on one, looking asymmetric. */
    white-space: nowrap;
}
/* Keeps the header row visible while scrolling long tables (History,
   Beneficiary Master), same idea as freezing row 1 in Google Sheets.
   Page-level sticky (thead stuck under the navbar while the whole page
   scrolls) turned out unreliable across browsers, so instead this wrapper
   gets its own bounded height + scrollbar, and the header sticks to the
   top of that - a much more consistently-supported pattern. */
.table-scroll-wrap {
    max-height: 70vh;
    overflow: auto;
}
.table-custom thead th {
    position: sticky;
    top: 0;
    z-index: 5;
}
.table-custom td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.875rem;
}
.table-custom tbody tr:hover {
    background-color: var(--gray-50);
}

.progress {
    height: 8px;
    border-radius: 4px;
}
.progress-bar {
    background-color: var(--primary);
}
