/* style.css - Universal Theme for Payables System */

/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
:root {
    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);

    /* iOS Color Palette */
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-gray: #8E8E93;

    /* Warning Theme Colors */
    --warning-red: #FF3B30;
    --warning-orange: #FF9500;

    /* Typography Colors - High Contrast */
    --text-main: #1d1d1f;
    /* Near Black */
    --text-secondary: #48484a;
    /* Dark Gray */
    --input-bg: #ffffff;
}

/* =========================================
   2. PAGE LAYOUT & ANIMATIONS
   ========================================= */
body {
    /* DEFAULT: Deep Blue Animated Gradient */
    background: linear-gradient(-45deg, #007AFF, #00c6ff, #0072ff, #004094);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    background-attachment: fixed;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    letter-spacing: -0.015em;

    /* Flexbox Sticky Footer Logic */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Specific Body Class for Login Page to Force Centering */
body.login-page {
    justify-content: center;
    align-items: center;
    padding: 20px;
    /* Provides breathing room on small screens */
}

/* Special Class for Error Pages (Classic) */
.bg-warning-mesh {
    background: radial-gradient(at 0% 0%, var(--warning-orange) 0%, transparent 50%),
        radial-gradient(at 100% 0%, var(--warning-red) 0%, transparent 50%),
        radial-gradient(at 100% 100%, #801b15 0%, transparent 50%),
        #000 !important;
    color: white !important;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

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

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

footer {
    margin-top: auto;
}

/* Prevent iOS Zoom on Input Focus */
input[type="text"],
input[type="password"],
input[type="number"] {
    font-size: 16px !important;
}

/* =========================================
   3. GLASS COMPONENTS
   ========================================= */

/* Main Dashboard Panels */

.glass-login {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
    /* Fallback centering */
}

.btn-ios-login {
    background: #FFFFFF !important;
    color: #000000 !important;
    border: none;
    border-radius: 14px;
    font-weight: 600;
    padding: 14px;
    width: 100%;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    display: block;
    /* Ensures visibility */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-ios-login:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.9) !important;
}

.form-control-ios {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-radius: 12px;
    padding: 12px;
}

.form-control-ios::placeholder {
    color: rgba(255, 255, 255, 0.5);
}


.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);

    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 28px;

    box-shadow: var(--glass-shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Ensure text inside panels is readable */
    color: var(--text-main);
}

/* Navigation Bar */
.glass-nav {
    background: rgba(0, 64, 148, 0.9) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Glass Card (Premium Blur for Login & Errors) */
.glass-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);

    border: 1px solid rgba(255, 255, 255, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 42px;

    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: fadeIn 0.8s ease-out;
    width: 100%;
}

/* =========================================
   4. ICONS & VISUALS
   ========================================= */

/* Animated Main Icon */
.icon-stack {
    position: relative;
    display: inline-block;
    margin-bottom: 25px;
}

.icon-main {
    font-size: 4rem;
    background: linear-gradient(180deg, #FFFFFF 0%, rgba(255, 255, 255, 0.5) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: pulse 2s infinite;
}

/* Standard Status Icons */
.lock-icon,
.error-icon {
    font-size: 3rem;
    color: var(--ios-red);
    margin-bottom: 20px;
    display: inline-block;
    background: white;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Version/Status Pill */
.version-pill {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

/* Code/Error Details Box */
.code-box,
.error-details {
    background: rgba(255, 255, 255, 0.9);
    color: #1c1c1e;
    padding: 16px;
    border-radius: 16px;
    font-family: monospace;
    font-size: 0.85rem;
    text-align: left;
    word-break: break-all;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* =========================================
   5. INPUTS & FORMS (Enhanced Visibility)
   ========================================= */

/* Standard Inputs - FORCE Text Color */
.form-control,
.form-select,
.branch-distribution-list {
    background-color: var(--input-bg) !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    border-radius: 12px !important;
    color: var(--text-main) !important;
    /* Forces Dark Text */
    font-weight: 600;
    padding: 10px 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

/* Focus State */
.form-control:focus,
.form-select:focus {
    background-color: #ffffff !important;
    border-color: var(--ios-blue) !important;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15) !important;
    transform: translateY(-1px);
    color: black !important;
    /* Ensure focus is always readable */
}

/* Placeholder Text Visibility */
.form-control::placeholder {
    color: #8E8E93;
    /* Darker than default for visibility */
    font-weight: 400;
    opacity: 1;
}

/* Disabled Inputs - Ensure they remain visible */
.form-control:disabled,
.form-select:disabled {
    background-color: rgba(239, 239, 244, 0.8) !important;
    /* Light Gray */
    color: #8E8E93 !important;
    /* Dark Gray Text */
    opacity: 1;
}

/* FORCE Option Text Color (Fixes White-on-White in Dropdowns) */
option {
    color: #000000 !important;
    background-color: #ffffff !important;
}

/* --- Login Page Specific Input Styles --- */

/* Icon Wrapper */
.input-group {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.input-group:focus-within {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Input Icon Section */
.input-group-text {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    /* Icon color */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Glass Card Input Override (Transparent background for Login ONLY) */
.glass-card .form-control {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    /* White text for dark login background */
    padding-left: 15px;
}

.glass-card .form-control:focus {
    box-shadow: none !important;
    background: rgba(255, 255, 255, 0.3) !important;
}

.glass-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

/* =========================================
   6. BUTTONS
   ========================================= */

/* Primary Dashboard Button */
.btn-primary {
    background: var(--ios-blue);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-primary:hover {
    background: #0062cc;
    transform: translateY(-1px);
}

/* Login Button (White on Glass) */
.btn-login {
    background: white;
    color: #007AFF;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-login:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    background: #f8f9fa;
    color: #0056b3;
}

.btn-login:active {
    transform: scale(0.98);
}

/* iOS Style Button (Blue) */
.btn-ios {
    background: var(--ios-blue);
    color: white;
    border-radius: 12px;
    padding: 12px 30px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-block;
    border: none;
}

.btn-ios:hover {
    background: #0062CC;
    color: white;
    transform: translateY(-2px);
}

/* iOS Style Button (Secondary Gray) */
.btn-ios-secondary {
    background: var(--ios-gray);
    color: white;
    border-radius: 12px;
    padding: 12px 30px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-block;
    border: none;
}

.btn-ios-secondary:hover {
    background: #636366;
    color: white;
    transform: translateY(-2px);
}

/* =========================================
   7. TABLES & DATA
   ========================================= */
.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.5);
    color: var(--text-main);
    /* Ensure table text is dark */
}

.table thead th {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 12px;
    font-weight: 700;
}

.table tbody tr {
    transition: background 0.2s ease;
    cursor: pointer;
}

.table tbody td {
    vertical-align: middle;
    font-size: 0.9rem;
    color: var(--text-main);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Text Helpers */
.small.fw-bold.text-secondary {
    color: var(--text-secondary) !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
    display: block;
}

/* Helper to force dark text anywhere */
.text-force-dark {
    color: #000000 !important;
}

.badge-verified {
    background: rgba(52, 199, 89, 0.15);
    color: var(--ios-green);
    border: 1px solid rgba(52, 199, 89, 0.2);
    font-weight: 600;
    border-radius: 10px;
}

.ios-search-pill {
    background: rgba(255, 255, 255, 0.8) !important;
    border-radius: 12px !important;
    border: 0.5px solid rgba(0, 0, 0, 0.1) !important;
    color: var(--text-main) !important;
}

.ios-caption {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    padding-left: 4px;
}

.supplier-text-container {
    width: 100%;
    min-width: 220px;
    white-space: normal;
    word-break: break-word;
}

.supplier-full-text {
    line-height: 1.2;
    font-size: 0.95rem;
    display: block;
    color: var(--text-main);
}

.supplier-full-text:not(:empty) {
    font-size: clamp(0.75rem, 2vw, 0.95rem);
}

/* =========================================
   8. MODALS & POPUPS
   ========================================= */
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    color: var(--text-main);
    /* Ensure modal text is dark */
}

#modalBalanceStatus {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.85rem;
}

/* =========================================
   9. Z-INDEX & LAYOUT FIXES
   ========================================= */
/* Navbar Logic */
.glass-nav {
    position: relative;
    z-index: 9999 !important;
}

/* Dropdown Menu (User/Logout) */
.dropdown-menu {
    z-index: 10000 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2) !important;
    border-radius: 16px !important;
    padding: 8px !important;
    margin-top: 10px !important;
}

.dropdown-item {
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-main);
    /* Fix dropdown item visibility */
}

.dropdown-item:hover {
    background: rgba(0, 122, 255, 0.1);
    color: var(--ios-blue);
}

/* Sticky Header Fix */
.table-responsive {
    z-index: 1;
}

/* Modals (Must overlay everything) */
.modal-backdrop {
    z-index: 20000 !important;
}

.modal {
    z-index: 20010 !important;
}

.datepicker,
.flatpickr-calendar {
    z-index: 20020 !important;
}

/* =========================================
   10. PRINT MEDIA QUERY
   ========================================= */
@media print {

    .glass-nav,
    .glass-panel form,
    .btn,
    .pagination,
    .ios-caption,
    .version-container,
    footer {
        display: none !important;
    }

    body {
        background: white !important;
        padding: 0 !important;
        color: black !important;
    }

    .glass-panel {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        color: black !important;
    }

    table {
        font-size: 9pt !important;
        width: 100% !important;
        border-collapse: collapse;
        color: black !important;
    }

    td,
    th {
        border: 1px solid #ddd !important;
        color: black !important;
    }
}

/* =========================================
   11. MAINTENANCE & SYNC VIEWS (Classic)
   ========================================= */

/* Use <body class="maintenance-mode"> to trigger the gray pattern background */
body.maintenance-mode {
    background-color: #f3f4f6;
    background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
    background-size: 20px 20px;
    animation: none;
    /* Disable blue gradient animation */

    /* Perfect Center Alignment */
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

/* Specific Card for Maintenance/Sync */
.glass-card-center {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-radius: 24px;
    padding: 40px;

    width: 90%;
    max-width: 420px;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin: auto;
}

.glass-card-center::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
}

.icon-spinner-circle {
    width: 80px;
    height: 80px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px auto;
    font-size: 2.5rem;
    animation: spin-slow 10s linear infinite;
}

.version-compare {
    display: inline-flex;
    align-items: center;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 50px;
    padding: 8px 16px;
    margin-bottom: 25px;
    font-size: 0.85rem;
    font-weight: 600;
}

.ver-local {
    color: var(--ios-red);
}

.ver-arrow {
    color: #9ca3af;
    margin: 0 10px;
    font-size: 1rem;
}

.ver-req {
    color: var(--ios-green);
}

.code-terminal {
    background: #1e1e1e;
    color: #10b981;
    font-family: 'Courier New', Courier, monospace;
    padding: 15px;
    border-radius: 12px;
    font-size: 0.9rem;
    text-align: left;
    display: flex;
    align-items: center;
    border: 1px solid #374151;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.1s;
    margin-bottom: 15px;
}

.code-terminal:active {
    transform: scale(0.98);
}

.code-terminal i {
    margin-right: 10px;
    color: #6b7280;
}

/* =========================================
   12. SYNC PAGE ANIMATION (Colorful Gradient)
   ========================================= */
body.sync-body {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientSync 15s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@keyframes gradientSync {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

body.sync-body .glass-card-center {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

@media (max-width: 480px) {
    .glass-card-center {
        width: 95% !important;
        padding: 25px 20px !important;
    }

    h2 {
        font-size: 1.5rem;
    }
}

/* =========================================
   13. MODERN SYNC PAGE (Aurora Theme)
   ========================================= */
body.sync-modern {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #0f172a;
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    overflow: hidden;
    position: relative;
}

body.sync-modern::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, transparent 50%),
        radial-gradient(circle, rgba(236, 72, 153, 0.15) 100%, transparent 50%);
    animation: auroraSpin 20s linear infinite;
    z-index: 0;
}

@keyframes auroraSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.mod-glass-card {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 440px;
    padding: 40px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 32px;
    animation: floatUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

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

.mod-glass-card h2 {
    color: white;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 25px;
}

.mod-glass-card .description {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.mod-icon-box {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px auto;
    font-size: 2rem;
    color: #38bdf8;
    box-shadow: 0 10px 30px -10px rgba(56, 189, 248, 0.3);
}

.mod-icon-box i {
    animation: spin-slow 10s linear infinite;
}

.mod-version-split {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ver-segment {
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: monospace;
}

.ver-segment.local {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.ver-segment.arrow {
    color: #64748b;
    padding: 6px 8px;
    display: flex;
    align-items: center;
}

.ver-segment.req {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.mod-terminal-btn {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mod-terminal-btn:hover {
    border-color: #38bdf8;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.4);
}

.mod-terminal-btn:active {
    transform: scale(0.98);
}

.cmd-text {
    font-family: 'Courier New', monospace;
    color: #38bdf8;
    font-weight: 600;
    transition: color 0.2s;
}

.cmd-icon {
    color: #475569;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.mod-terminal-btn:hover .cmd-icon {
    color: white;
}

.mod-terminal-btn.copied {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.05);
}

.mod-terminal-btn.copied .cmd-text {
    color: #4ade80;
}

/* =========================================
   14. ERROR / 404 PAGE STYLES (Standalone)
   ========================================= */

/* Dark Mesh Background for 404/500 Pages */
body.bg-mesh-dark {
    background: radial-gradient(at 0% 0%, #007AFF 0%, transparent 50%),
        radial-gradient(at 100% 0%, #5856D6 0%, transparent 50%),
        radial-gradient(at 100% 100%, #004094 0%, transparent 50%),
        #000;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Wrapper to hold the card and background effects together */
.glass-container {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Central Glass Container */
.glass-focus-card {
    position: relative;
    z-index: 2;
    /* Ensure it sits above the blur circle */
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);

    /* Increased border opacity for better visibility */
    border: 1px solid rgba(255, 255, 255, 0.3);

    border-radius: 40px;
    padding: 60px 40px;
    text-align: center;
    color: white;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 90%;
    /* Mobile safety */
    margin: 0 auto;
    /* explicit centering */
}

/* Big Hero Gradient Text */
.text-hero-gradient {
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 10px;
    display: block;
    background: linear-gradient(180deg, #FFFFFF 30%, rgba(255, 255, 255, 0.1) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.2));
    letter-spacing: -2px;
    word-wrap: break-word;
}

/* Message Title */
.msg-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: -10px;
    letter-spacing: -0.02em;
    color: white;
}

/* White iOS Button */
.btn-ios-white {
    background: white;
    color: black;
    border-radius: 18px;
    padding: 14px 32px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    margin-top: 20px;
    cursor: pointer;
}

.btn-ios-white:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    color: black;
}

/* Background Blur Decoration */
.blur-circle {
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--ios-blue);
    filter: blur(100px);
    border-radius: 50%;
    z-index: -1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.5;
}


/* =========================================
   15. SERVER ERROR (50x) STYLES
   ========================================= */

/* Warning Gradient Background */
body.bg-gradient-error {
    background: linear-gradient(135deg, #FF9500 0%, #FF3B30 100%);
    /* Orange to Red */
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    overflow: hidden;
}

/* Error Specific Glass Card (Lighter than 404) */
.glass-error-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 32px;
    padding: 40px;
    text-align: center;
    color: white;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 10;
}

/* White Button with Red Text */
.btn-ios-red {
    background: white;
    color: #FF3B30;
    /* iOS Red */
    border: none;
    border-radius: 50px;
    /* Pill shape */
    padding: 12px 30px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    cursor: pointer;
}

.btn-ios-red:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.95);
    color: #FF3B30;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.btn-ios-red:active {
    transform: scale(0.98);
}

/* Custom utility for extra small text in tables */
.text-xs {
    font-size: 0.7rem !important;
    letter-spacing: 0.02em;
    font-family: 'SFMono-Regular', Consolas, monospace;
    /* Monospace is easier to read for numbers */
}


.aging-bucket {
    font-size: 0.75rem;
    text-align: right;
    min-width: 70px;
}

.grand-total {
    background: rgba(0, 122, 255, 0.1) !important;
    font-weight: bold;
    font-size: 0.85rem;
}

.cursor-pointer {
    cursor: pointer;
}

.cursor-pointer:hover {
    background-color: rgba(0, 122, 255, 0.05);
}

.table-responsive {
    overflow-x: auto;
    white-space: nowrap;
}

/* Sticky Column for Supplier Name */
.sticky-col {
    position: sticky;
    left: 0;
    background-color: #fff;
    z-index: 10;
    border-right: 1px solid #dee2e6;
}

.grand-total .sticky-col {
    background-color: #e6f2ff;
}

/* Compact DR/Invoice Tags */
.dr-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    max-width: 220px;
    /* Constrain width to force wrapping */
    margin: 0 auto;
}

.dr-tag {
    font-family: 'SF Mono', 'Menlo', Monaco, Consolas, monospace;
    font-size: 0.75rem;
    background-color: #f5f9ff;
    color: #0056b3;
    border: 1px solid rgba(0, 86, 179, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    transition: all 0.2s;
}

.dr-tag:hover {
    background-color: #0056b3;
    color: white;
    border-color: #0056b3;
}

/* 1. Supplier Auto-Scaling Container */
.supplier-cell-wrapper {
    width: 260px;
    /* Max width before scaling happens */
    white-space: nowrap;
    /* Keep text on one line */
    overflow: hidden;
    /* Hide overflow */
    display: flex;
    /* Aligns text vertically */
    flex-direction: column;
    justify-content: center;
}

.dynamic-font-name {
    display: inline-block;
    transform-origin: left center;
    /* Scale from the left */
    font-weight: 700;
    color: #212529;
    font-size: 1rem;
    /* Starting size */
    line-height: 1.2;
}

.supplier-tin {
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 2px;
}

/* 2. Compact DR Tags */
.dr-tag-container {
    display: flex;
    flex-wrap: wrap;
    /* Allows wrapping */
    gap: 3px;
    /* Tiny gap between numbers */
    justify-content: center;
    max-width: 180px;
    /* Constrain width to force wrapping */
    margin: 0 auto;
}

.dr-tag {
    font-family: 'SF Mono', 'Menlo', Monaco, Consolas, monospace;
    font-size: 0.7rem;
    /* Smaller font */
    background-color: #f8f9fa;
    color: #0d6efd;
    border: 1px solid rgba(13, 110, 253, 0.2);
    padding: 0px 5px;
    /* Tight padding */
    border-radius: 4px;
    /* Soft square corners instead of large pills */
    cursor: default;
    transition: all 0.1s;
}

.dr-tag:hover {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

.dr-tag-more {
    background-color: #e9ecef;
    color: #495057;
    border: 1px dashed #ced4da;
    cursor: help;
    /* Shows a question mark cursor to imply there's a tooltip */
    font-weight: bold;
}

.dr-tag-more:hover {
    background-color: #dee2e6;
    color: #212529;
    border-color: #adb5bd;
}

.dr-tag-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    /* Space between tags */
    /* Adjust this width based on your actual tag size. 
       Formula: (Tag Width + Gap) * 5 
    */
    max-width: 250px;
    margin: 0 auto;
}


.dr-tag {
    /* Ensure tags have a consistent look so the grid stays even */
    flex: 0 0 auto;
    width: 45px;
    text-align: center;
    font-size: 0.75rem;
    padding: 2px 0;
    border-radius: 4px;
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.2);
}



body {
    background-color: #1a1d20;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.img-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

.toolbar {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}




/* --- Glassmorphism Card --- */
.mod-glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* --- Header & Icon --- */
.mod-icon-box {
    width: 64px;
    height: 64px;
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 24px auto;
}

.mod-glass-card h2 {
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

/* --- Version Splitter --- */
.mod-version-split {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.ver-segment {
    font-family: 'JetBrains Mono', monospace;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.ver-segment.local {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.ver-segment.req {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.ver-segment.arrow {
    color: #64748b;
    padding: 0;
}

/* --- Typography --- */
.description {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

/* --- Terminal Copy Button --- */
.mod-terminal-btn {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mod-terminal-btn:hover {
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.cmd-text {
    font-family: 'JetBrains Mono', monospace;
    color: #e2e8f0;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.cmd-icon {
    color: #64748b;
    transition: color 0.2s ease;
}

.mod-terminal-btn:hover .cmd-icon {
    color: #e2e8f0;
}

/* --- Copied State Animation --- */
.mod-terminal-btn.copied {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    transform: translateY(0);
    box-shadow: none;
}

.mod-terminal-btn.copied .cmd-text,
.mod-terminal-btn.copied .cmd-icon {
    color: #10b981;
}

/* =========================================
   SYSTEM OFFLINE PAGE (Centering Fix)
   ========================================= */
body.offline-mode {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    min-height: 100vh !important;
    margin: 0 !important;

    /* Force Absolute Centering */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Constrain and center ONLY the offline panel */
.offline-mode .glass-panel {
    max-width: 400px;
    width: 90%;
    padding: 48px 32px;
    text-align: center;
    margin: auto;
    /* Fallback centering */

    /* Dark mode text overrides */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.offline-mode .glass-panel h4 {
    color: #ffffff;
}

.offline-mode .glass-panel p {
    color: #94a3b8 !important;
}

/* =========================================
   16. MOBILE RESPONSIVENESS (NEW)
   ========================================= */
@media (max-width: 768px) {
    .glass-login {
        padding: 30px 20px;
        border-radius: 24px;
        width: 95%;
        /* Better fit for smaller screens */
    }

    .glass-panel {
        padding: 20px 15px;
        border-radius: 20px;
    }

    .glass-focus-card,
    .glass-error-card,
    .mod-glass-card {
        padding: 30px 20px;
        width: 95%;
    }

    .text-hero-gradient {
        font-size: 3rem;
        /* Prevents overflow on mobile 404 pages */
    }

    body.login-page {
        padding: 15px;
    }
}