/* ==========================================================================
   SCPMS Master Main CSS - Standardized & Refactored for Multi-Screen Consistency
   Viewports Covered: 4K (2560px), Laptop L (1440px), Laptop (1024px),
                      Tablet (768px), Mobile L (425px), Mobile M (375px), Mobile S (320px)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CORE VARIABLES & DESIGN SYSTEM TOKENS
   -------------------------------------------------------------------------- */
:root {
    --brand-primary: #e53935;
    --brand-soft: #FF9494;
    --brand-light: #FFD1D1;
    --brand-dark: #9B1C1C;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --brand-600: #dc2626;
    --brand-700: #b91c1c;

    /* Responsive Spacing & Layout Tokens */
    --header-height: 70px;
    --sidebar-width: 16rem;
    --border-radius-card: 1.25rem;
}

/* --------------------------------------------------------------------------
   2. BASE TYPOGRAPHY & BODY STYLING
   -------------------------------------------------------------------------- */
body { 
    font-family: 'Poppins', sans-serif; 
    color: #2d3748;
    background: linear-gradient(135deg, #FFF5E4 0%, #FFE3E1 100%);
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

/* --------------------------------------------------------------------------
   3. GLASSMORPHISM & CONTAINER CARDS
   -------------------------------------------------------------------------- */
.glass-card, .glass-panel {
    backdrop-filter: blur(12px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
    background: rgba(255, 255, 255, 0.22) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.75) !important;
    box-shadow: 0 8px 32px 0 rgba(229, 57, 53, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.5) !important;
    transition: all 0.3s ease;
    border-radius: var(--border-radius-card);
    width: 100%;
    max-width: 960px;
}

.glass-panel:hover, .glass-card:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    box-shadow: 0 12px 40px 0 rgba(229, 57, 53, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.8) !important;
}

/* Sidebar Frosted Glass Styling */
aside.site-sidebar {
    background: rgba(255, 255, 255, 0.20) !important;
    backdrop-filter: blur(14px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(14px) saturate(180%) !important;
    border-right: 1.5px solid rgba(255, 255, 255, 0.75) !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-radius: 0 1.25rem 1.25rem 0 !important;
    box-shadow: 6px 0 25px rgba(229, 57, 53, 0.05) !important;
}

/* Offcanvas Glassmorphism Drawer */
.glass-offcanvas {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-right: 1.5px solid rgba(255, 255, 255, 0.75) !important;
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.1) !important;
}

/* --------------------------------------------------------------------------
   4. LAYOUT COMPONENTS (Header, Sidebar, Content, Footer)
   -------------------------------------------------------------------------- */
header.site-header {
    height: var(--header-height);
    flex-shrink: 0;
}

footer.site-footer {
    height: auto;
    flex-shrink: 0;
}

main.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.login-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Brand Title Responsiveness */
.header-brand-title {
    max-width: calc(100vw - 160px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Fluid image & layout classes */
.responsive-logo {
    height: 4.5vh !important;
    width: auto;
    max-height: 50px;
    object-fit: contain;
}

.system-brand-logo {
    height: 6vh !important;
    width: auto;
    max-height: 65px;
    object-fit: contain;
}

.fluid-headline {
    font-size: clamp(1.5rem, 2.2vw, 2.5rem) !important;
    font-weight: 700;
    line-height: 1.2;
}

.ambient-blob {
    width: 20vw !important;
    height: 20vw !important;
    border-radius: 50%;
    filter: blur(60px);
    position: absolute;
}

/* --------------------------------------------------------------------------
   5. BUTTONS, FORMS & INPUT UTILITIES
   -------------------------------------------------------------------------- */
.btn-primary-custom {
    background: linear-gradient(135deg, #FF9494 0%, #FFD1D1 100%);
    color: white;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary-custom:hover {
    background: linear-gradient(135deg, #FFD1D1 0%, #FF9494 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(255, 148, 148, 0.3);
    color: white;
}

.form-input {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    padding: 0.75rem 1rem;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: #FF9494;
    box-shadow: 0 0 0 3px rgba(255, 148, 148, 0.25);
    background: #ffffff;
}

.fade-in { animation: fadeIn 0.4s ease-in-out; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Tailwind-like Utilities */
.text-brand-primary { color: var(--brand-primary) !important; }
.text-brand-soft { color: var(--brand-soft) !important; }
.bg-brand-soft { background-color: var(--brand-soft) !important; }
.bg-brand-600 { background-color: var(--brand-600) !important; }
.hover-bg-brand-700:hover { background-color: var(--brand-700) !important; }

.text-slate-200 { color: var(--slate-200) !important; }
.text-slate-300 { color: var(--slate-300) !important; }
.text-slate-400 { color: var(--slate-400) !important; }
.text-slate-500 { color: var(--slate-500) !important; }
.text-slate-600 { color: var(--slate-600) !important; }
.text-slate-700 { color: var(--slate-700) !important; }
.text-slate-800 { color: var(--slate-800) !important; }

.bg-slate-50 { background-color: var(--slate-50) !important; }
.bg-slate-100 { background-color: var(--slate-100) !important; }
.bg-slate-200 { background-color: var(--slate-200) !important; }
.bg-slate-700 { background-color: var(--slate-700) !important; }
.bg-slate-800 { background-color: var(--slate-800) !important; }
.bg-slate-900 { background-color: var(--slate-900) !important; }

.border-slate-200 { border-color: var(--slate-200) !important; }
.border-slate-300 { border-color: var(--slate-300) !important; }
.border-slate-700 { border-color: var(--slate-700) !important; }

.tracking-tight { letter-spacing: -0.025em !important; }
.tracking-wide { letter-spacing: 0.025em !important; }
.tracking-wider { letter-spacing: 0.05em !important; }

.opacity-0 { opacity: 0 !important; }
.opacity-100 { opacity: 1 !important; }
.transition-all { transition-property: all !important; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important; transition-duration: 150ms !important; }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke !important; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important; transition-duration: 150ms !important; }
.duration-300 { transition-duration: 300ms !important; }

.cursor-pointer { cursor: pointer !important; }
.cursor-default { cursor: default !important; }

.group:hover .group-hover\:opacity-100 { opacity: 1 !important; }
.group:hover .group-hover\:visible { visibility: visible !important; }

::selection {
    background-color: var(--brand-soft);
    color: white;
}

/* --------------------------------------------------------------------------
   6. SIDEBAR NAVIGATION STYLING
   -------------------------------------------------------------------------- */
.sidebar-nav-link {
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3.5px solid transparent;
}

.sidebar-nav-link:hover {
    background: rgba(255, 209, 209, 0.28) !important;
    color: var(--brand-700) !important;
}

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

.sidebar-nav-link.active {
    background: linear-gradient(135deg, rgba(255, 148, 148, 0.22) 0%, rgba(255, 209, 209, 0.38) 100%) !important;
    border-left: 4px solid var(--brand-soft) !important;
    color: var(--brand-700) !important;
    font-weight: 600 !important;
    box-shadow: inset 0 0 10px rgba(255, 148, 148, 0.12), 0 2px 6px rgba(229, 57, 53, 0.06);
}

.sidebar-nav-link.active svg {
    color: var(--brand-primary) !important;
}

.sidebar-subnav-link {
    position: relative;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.sidebar-subnav-link:hover {
    background: rgba(255, 209, 209, 0.22) !important;
    color: var(--brand-700) !important;
}

.sidebar-subnav-link.active {
    background: rgba(255, 148, 148, 0.2) !important;
    border-left: 3px solid var(--brand-soft) !important;
    color: var(--brand-700) !important;
    font-weight: 600 !important;
}

/* --------------------------------------------------------------------------
   7. DATATABLES & TABLE RESPONSIVENESS OVERRIDES
   -------------------------------------------------------------------------- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.85rem !important;
}

/* --------------------------------------------------------------------------
   8. RESPONSIVE BREAKPOINT SPECIFICATIONS
   -------------------------------------------------------------------------- */

/* --- 4K & Ultra Wide Screens (>= 2560px) --- */
@media (min-width: 2560px) {
    html {
        font-size: 18px;
    }
    .glass-card, .glass-panel {
        max-width: 1400px;
    }
    header.site-header {
        height: 80px;
    }
}

/* --- Desktop & Laptop L (1440px - 2559px) --- */
@media (min-width: 1440px) and (max-width: 2559.98px) {
    html {
        font-size: 16px;
    }
    .glass-card, .glass-panel {
        max-width: 1100px;
    }
}

/* --- Standard Desktop & Laptop (992px - 1439px) --- */
@media (min-width: 992px) and (max-width: 1439.98px) {
    html {
        font-size: 15px;
    }
    main.main-content {
        padding: 1.25rem;
    }
}

/* --- Tablet Devices (768px - 991.98px) --- */
@media (min-width: 768px) and (max-width: 991.98px) {
    html {
        font-size: 14.5px;
    }
    header.site-header {
        height: 65px;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    main.main-content {
        padding: 1rem;
        width: 100% !important;
    }
    .glass-card, .glass-panel {
        max-width: 100%;
        border-radius: 1rem;
    }
    .header-brand-title {
        font-size: 1.1rem !important;
        max-width: 480px;
    }
}

/* --- Mobile Large Devices (425px - 767.98px) --- */
@media (min-width: 425px) and (max-width: 767.98px) {
    html {
        font-size: 14px;
    }
    header.site-header {
        height: 60px;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    main.main-content {
        padding: 0.75rem;
    }
    .glass-card, .glass-panel {
        max-width: 100%;
        border-radius: 0.85rem;
    }
    .header-brand-title {
        font-size: 0.95rem !important;
        max-width: 260px;
    }
    .system-brand-logo {
        height: 40px !important;
    }
}

/* --- Mobile Medium Devices (375px - 424.98px) --- */
@media (min-width: 375px) and (max-width: 424.98px) {
    html {
        font-size: 13.5px;
    }
    header.site-header {
        height: 56px;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    main.main-content {
        padding: 0.5rem;
    }
    .glass-card, .glass-panel {
        border-radius: 0.75rem;
    }
    .header-brand-title {
        font-size: 0.85rem !important;
        max-width: 200px;
    }
    .system-brand-logo {
        height: 35px !important;
    }
}

/* --- Mobile Small Devices (< 375px) --- */
@media (max-width: 374.98px) {
    html {
        font-size: 13px;
    }
    header.site-header {
        height: 54px;
        padding-left: 0.4rem !important;
        padding-right: 0.4rem !important;
    }
    main.main-content {
        padding: 0.35rem;
    }
    .header-brand-title {
        font-size: 0.8rem !important;
        max-width: 160px;
    }
    .system-brand-logo {
        height: 32px !important;
    }
}

/* --------------------------------------------------------------------------
   9. GLOBAL LOADING OVERLAY
   -------------------------------------------------------------------------- */
.global-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.global-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.glass-loading-box {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 1.25rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    min-width: 280px;
    max-width: 360px;
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.global-loading-overlay.active .glass-loading-box {
    transform: scale(1);
}

.loader-spinner-container {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-ring {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3.5px solid rgba(229, 57, 53, 0.15);
    border-top: 3.5px solid #e53935;
    border-radius: 50%;
    animation: loader-spin 0.9s linear infinite;
}

.loader-ring-outer {
    position: absolute;
    width: 94px;
    height: 94px;
    border: 2px solid transparent;
    border-bottom: 2px solid rgba(229, 57, 53, 0.45);
    border-radius: 50%;
    animation: loader-spin-reverse 1.4s linear infinite;
}

.loader-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    animation: loader-pulse 1.3s ease-in-out infinite alternate;
}

@keyframes loader-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes loader-spin-reverse {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

@keyframes loader-pulse {
    0% { transform: scale(0.90); opacity: 0.8; }
    100% { transform: scale(1.10); opacity: 1; }
}
