/* /app/static/css/style.css */

:root {
    --primary-color: #007bff;
    --bg-color: #f8f9fa;
    --text-color: #000000;
    --card-bg: #ffffff;
}

[data-bs-theme="dark"] {
    --bg-color: #343a40;
    --text-color: #ffffff;
    --card-bg: #495057;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.card {
    background-color: var(--card-bg);
}

.navbar {
    border-bottom: 1px solid var(--primary-color);
}

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

.table th,
.table td {
    vertical-align: middle;
}

/* Fix button widths in tables for a uniform look */
.table .btn-sm {
    min-width: 100px;
    margin: 2px;
}

.alert {
    margin-bottom: 1rem;
}

/* Adds shadow and border for better visibility, ensures image loads */
.login-logo {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    border-radius: 50%;
    border: 2px solid var(--bs-primary);
}

/* Custom styles for tables generated from Markdown content */
.card-body table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-collapse: collapse;
    /* Ensures borders are clean */
}

.card-body table th,
.card-body table td {
    padding: .25rem;
    vertical-align: middle;
    border-top: 1px solid var(--bs-border-color);
}

.card-body table thead th {
    border-bottom-width: 2px;
}

/* Make vertical borders (column separators) thicker */
.card-body table th,
.card-body table td {
    border-right: 2px solid var(--bs-border-color);
}

/* Add a left border to the first column */
.card-body table th:first-child,
.card-body table td:first-child {
    border-left: 2px solid var(--bs-border-color);
}

/* Make tables responsive by default */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    /* Force the table to not behave like a table */
    .public-dashboard table, 
    .public-dashboard thead, 
    .public-dashboard tbody, 
    .public-dashboard th, 
    .public-dashboard td, 
    .public-dashboard tr { 
        display: block; 
        width: 100%;
    }

    /* Hide table headers (labels will be redundant) */
    .public-dashboard thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .public-dashboard tr { 
        border: 1px solid var(--bs-border-color);
        margin-bottom: 1rem;
        border-radius: 8px;
        padding: 10px;
        background: var(--card-bg);
    }

    .public-dashboard td { 
        border: none !important;
        position: relative;
        padding-left: 0 !important;
        white-space: normal !important; /* Fixes the horizontal stretching */
        text-align: left;
    }

    /* Emphasize the first cell (The Account Type) */
    .public-dashboard td:first-child {
        font-size: 1.1rem;
        color: var(--primary-color);
        border-bottom: 1px solid var(--bs-border-color) !important;
        margin-bottom: 5px;
    }
}

/* Shortcut Grid Styles */
.shortcut-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 20px 0;
}

.shortcut-card {
    width: 110px;
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
    background-color: var(--card-bg);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.shortcut-card:hover {
    transform: translateY(-5px);
    background-color: var(--primary-color);
    color: white !important;
    box-shadow: 0 8px 15px rgba(0, 123, 255, 0.2);
}

.shortcut-card i {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.shortcut-card span {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    padding: 0 5px;
}

/* Image Hover Zoom Effect */
.img-hover-zoom {
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    cursor: zoom-in;
    position: relative;
    z-index: 1;
}

.img-hover-zoom:hover {
    transform: scale(3.5); /* I increased this for better visibility in tables */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    z-index: 9999 !important; /* Ensures it floats above everything else */
}

/* Fix for table clipping */
.table td, .table th {
    overflow: visible !important; /* This prevents the image from being cut off by the cell border */
}

/* Fix for Navbar clipping */
.navbar, .nav-item {
    overflow: visible !important;
}

/* Mobile Tab Bar Enhancements */
#mobile-tab-bar .d-flex::-webkit-scrollbar {
    display: none;
}

#mobile-tab-bar .btn {
    border-radius: 20px;
    padding-left: 15px;
    padding-right: 15px;
    font-weight: 500;
}

/* Ensure images don't get hidden under the sticky tab bar */
.sticky-top {
    z-index: 1020;
}

/* Styling the internal PWA tabs to look like a browser strip */
.pwa-tab-wrapper { position: relative; }
.pwa-tab {
    display: inline-block;
    padding: 8px 35px 8px 15px;
    text-decoration: none;
    color: var(--bs-body-color);
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.1);
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    font-size: 0.85rem;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pwa-tab.active {
    background: var(--bs-body-bg);
    border-bottom: 2px solid var(--bs-primary);
    color: var(--bs-primary);
    font-weight: bold;
}
.tab-close {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0.5;
    font-size: 1.1rem;
}
.tab-close:hover { opacity: 1; color: #dc3545; }


/* Container for the dashboard hero area */
.dashboard-animation-container {
    display: inline-block;
    position: relative;
    max-width: 600px;
    width: 100%;
}

.splash-main {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    transition: transform 0.3s ease;
}

/* Position the pulsing logo over the banner */
.logo-overlay {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
}

.logo-pulse-small {
    width: 90px;
    height: 90px;
    background: #050a0f; /* Matches your body background */
    padding: 10px;
    border-radius: 50%;
    filter: drop-shadow(0 0 10px #ffcc00);
    animation: dashboardPulse 2.5s infinite ease-in-out;
}

@keyframes dashboardPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 5px #ffcc00); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 20px #ffcc00); }
}

/* Hover effect for interaction */
.dashboard-animation-container:hover .splash-main {
    transform: translateY(-5px);
}


/* --- UNIFIED PAGE LOADER --- */
#page-loader {
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    background: #343a40; /* Matches theme_color */
    display: none;
    opacity: 0;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

#page-loader.show {
    display: flex;
    opacity: 1;
}

/* Helper class to hide loader via JS */
#page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-card {
    background: #0a1219;
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    width: 240px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.loader-content {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader-logo {
    width: 65px;
    height: 65px;
    z-index: 1;
    /* Ensures no old animations conflict */
    animation: none !important; 
}

.blue-ring {
    position: absolute;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 8px solid #002d5f; /* Deep dark blue */
    z-index: 10;
}

.orbit {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    animation: rotate-point 1.2s infinite linear;
    z-index: 20;
}

.point {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 8px; height: 8px;
    background: #ffcc00;
    border-radius: 50%;
    box-shadow: 0 0 10px #ffcc00;
}

.loader-text {
    color: white;
    font-size: 1rem;
    letter-spacing: 3px;
    margin: 0;
    text-transform: uppercase;
}

/* Animations */
@keyframes rotate-point {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.dots::after {
    content: '';
    animation: dot-cycle 1.5s infinite;
}

@keyframes dot-cycle {
    0% { content: ''; }
    33% { content: '.'; }
    66% { content: '..'; }
    100% { content: '...'; }
}

/* Force Dash dropdowns to match your theme */
.Select-control, .Select-menu-outer, .is-open > .Select-control {
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
}

.VirtualizedSelectFocusedOption {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-primary) !important;
}