/* style.css */

/* ========================================= /
/ BASE THEME & SCROLLBARS                   /
/ ========================================= */
body {
background-color: #0f172a;
color: #f8fafc;
}

::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: #0f172a;
}
::-webkit-scrollbar-thumb {
background: #334155;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #475569;
}

/* ========================================= /
/ REUSABLE UI COMPONENTS                    /
/ ========================================= */
.glass-panel {
background: rgba(30, 41, 59, 0.7);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
}

.loader {
border: 3px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top: 3px solid #3b82f6;
width: 20px;
height: 20px;
animation: spin 1s linear infinite;
display: none;
vertical-align: middle;
margin-right: 8px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}

/* ========================================= /
/ COMPONENT STYLING                         /
/ ========================================= */

/* Small, Red, Circular Lock Button */
.btn-lock-sm {
width: 32px;
height: 32px;
border-radius: 50%;
background-color: #ef4444;
color: white;
display: flex;
align-items: center;
justify-content: center;
border: none;
cursor: pointer;
transition: all 0.2s ease-in-out;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-lock-sm:hover {
background-color: #dc2626;
transform: scale(1.1);
box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3);
}

.btn-lock-sm:active {
transform: scale(0.95);
}

/* Absolute Positioning for Search Clear Button */
.search-container {
position: relative;
width: 100%;
}

.search-clear-btn {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
background: transparent;
border: none;
cursor: pointer;
color: #64748b;
padding: 4px;
display: flex;
align-items: center;
justify-content: center;
transition: color 0.2s ease;
z-index: 10;
}

.search-clear-btn:hover {
color: #f8fafc;
}

/* ========================================= /
/ STATUS BADGES                             /
/ ========================================= */
.status-badge {
font-size: 0.7rem;
text-transform: uppercase;
padding: 2px 8px;
border-radius: 9999px;
font-weight: 600;
}
.past-due {
background: #7f1d1d;
color: #fecaca;
border: 1px solid #991b1b;
}
.due-today {
background: #1e3a8a;
color: #bfdbfe;
border: 1px solid #1e40af;
}
.due-upcoming {
background: #064e3b;
color: #a7f3d0;
border: 1px solid #065f46;
}

/* ========================================= /
/ MODAL, IFRAME, & POPUP SPECIFICS          /
/ ========================================= */
.modal-content {
max-height: 80vh;
overflow-y: auto;
}
#app-frame {
transition: opacity 0.3s ease;
}
.loading {
opacity: 0.5;
pointer-events: none;
}

/* Mobile Background Sync Popup Fix */
#sync-warning {
max-height: 20vh;
bottom: env(safe-area-inset-bottom, 1.5rem);
overflow-y: auto;
z-index: 100;
}

/* ========================================= /
/ MOBILE RESPONSIVE LAYOUT SHIFTS           /
/ ========================================= */
@media (max-width: 768px) {
body {
flex-direction: column !important;
}
aside {
width: 100% !important;
height: auto !important;
border-right: none !important;
border-bottom: 1px solid #1e293b;
}
#sidebar-nav {
flex-direction: row !important;
overflow-x: auto;
padding: 0 1rem;
-webkit-overflow-scrolling: touch;
}
#sidebar-nav::-webkit-scrollbar {
display: none;
}
.nav-link {
white-space: nowrap;
padding: 0.75rem 1rem !important;
border-left: none !important;
border-bottom: 3px solid transparent;
border-radius: 0;
}
.nav-link.active {
background-color: transparent !important;
border-bottom-color: #3b82f6 !important;
color: #60a5fa !important;
}
.branding-header {
padding: 0.75rem 1.5rem !important;
}

/* Admin Mobile Cards */
.admin-table thead { 
    display: none; 
}
.admin-table tr { 
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem; 
    margin-bottom: 1rem; 
    padding: 1rem; 
    background: rgba(30, 41, 59, 0.5); 
    border-radius: 0.5rem; 
    border: 1px solid #1e293b; 
}
.admin-table td { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 !important; 
    border: none !important; 
    text-align: right; 
}
.admin-table td::before { 
    content: attr(data-label); 
    font-weight: bold; 
    color: #64748b; 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    margin-right: 1rem; 
    text-align: left; 
}

/* Mobile Sync Popup Adjustment */
#sync-warning {
    width: 90%;
    left: 5%;
    right: 5%;
    max-height: 25vh;
    overflow-y: auto;
}
}