/* 
 * SPMB Mini - Modern Blue Theme
 * Custom Styles for Bootstrap 5.3 
 */

:root {
    --blue-50: #f0f7ff;
    --blue-100: #e0effe;
    --blue-200: #bae0fd;
    --blue-300: #7cc8fb;
    --blue-400: #38abf8;
    --blue-500: #0ea5e9; /* Primary Blue */
    --blue-600: #0284c7;
    --blue-700: #0369a1;
    --blue-800: #075985;
    --blue-900: #0c4a6e;
    --blue-950: #082f49;
    
    --primary-color: var(--blue-600);
    --secondary-color: var(--blue-500);
}

/* Theme Variables for Scrollbar */
:root {
    --sb-track: transparent;
    --sb-thumb: #94a3b8;
    --sb-thumb-hover: #64748b;
}

[data-bs-theme="dark"] {
    color-scheme: dark;
    --sb-track: #000000;
    --sb-thumb: #334155;
    --sb-thumb-hover: #475569;
}

[data-bs-theme="light"] {
    color-scheme: light;
}

/* Global Scrollbar Styles */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: var(--sb-track);
}
::-webkit-scrollbar-thumb {
    background: var(--sb-thumb);
    border-radius: 20px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--sb-thumb-hover);
}

/* Firefox support */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--sb-thumb) var(--sb-track);
}

html {
    scrollbar-gutter: stable;
}

html, body {
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    font-weight: 400;
    overflow-x: hidden;
    min-width: 320px; /* Minimum supported width (iPhone SE) */
}

/* Global box-sizing & overflow containment for mobile safety */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Prevent any element from stretching beyond its parent on mobile */
@media (max-width: 768px) {
    img, video, svg, canvas, iframe {
        max-width: 100%;
        height: auto;
    }
    .btn, button {
        max-width: 100%;
        white-space: normal;
        word-break: break-word;
    }
    /* Prevent flex children from overflowing */
    .d-flex, [class*="gap-"] {
        min-width: 0;
    }
}

[data-bs-theme="dark"], [data-bs-theme="dark"] body {
    background-color: #0b1120;
}

section[id], div[id] {
    scroll-margin-top: 85px;
}

.bg-theme {
    background-color: var(--primary-color) !important;
}

.text-theme {
    color: var(--primary-color) !important;
}

.btn-theme {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-theme:hover {
    background-color: var(--blue-700);
    border-color: var(--blue-700);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.card-theme-border {
    border-top: 4px solid var(--primary-color);
}

.glass-morphism {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Navbar customizations */
.navbar-theme {
    background: white;
    border-bottom: 1px solid var(--blue-100);
}

.navbar-theme .navbar-brand, .navbar-theme .nav-link {
    color: var(--blue-900) !important;
}

/* Animated Hover Line for Navbar */
.navbar-theme a.nav-link {
    position: relative;
    font-weight: 500;
}

.navbar-theme a.nav-link::before {
    content: '';
    position: absolute;
    height: 2px;
    bottom: 4px;
    left: 8px;
    right: 8px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.navbar-theme a.nav-link:hover::before,
.navbar-theme a.nav-link.active::before {
    transform: scaleX(1);
}

.navbar-theme .nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
}

/* User Login / Profile Button in Navbar */
.btn-nav-login {
    color: var(--blue-900);
    border: 1px solid transparent;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-bs-theme="dark"] .btn-nav-login {
    color: #f1f5f9;
}

/* Hover and Active State (Background animation, remove border/box-shadow) */
.btn-nav-login:focus,
.btn-nav-login:active,
.btn-nav-login.show {
    box-shadow: none !important;
    border-color: transparent !important;
    background-color: var(--blue-50) !important;
    color: var(--primary-color) !important;
}

.btn-nav-login:hover {
    background-color: var(--blue-50);
    color: var(--primary-color);
}

[data-bs-theme="dark"] .btn-nav-login:focus,
[data-bs-theme="dark"] .btn-nav-login:active,
[data-bs-theme="dark"] .btn-nav-login.show,
[data-bs-theme="dark"] .btn-nav-login:hover {
    background-color: rgba(14, 165, 233, 0.15) !important;
    color: #38bdf8 !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Typography */
.hero-title {
    font-size: 2.25rem;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-500) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent !important;
}
@media (min-width: 992px) {
    .hero-title {
        font-size: calc(1.525rem + 3.3vw); /* equivalent to display-3 */
        letter-spacing: -2px;
    }
}
[data-bs-theme="dark"] .hero-title {
    background: linear-gradient(135deg, #f8fafc 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent !important;
}

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

/* Dashboard Sidebar */
.sidebar {
    min-height: 100vh;
    background: white;
    border-right: 1px solid var(--blue-100);
    color: var(--blue-900);
}

[data-bs-theme="dark"] .sidebar {
    background: #0f172a;
    border-right: 1px solid #1e293b;
    color: #f8fafc;
}

.sidebar .nav-link {
    color: var(--blue-700);
    padding: 0.8rem 1.5rem;
    border-radius: 0.5rem;
    margin: 0.2rem 1rem;
    transition: all 0.2s;
}

[data-bs-theme="dark"] .sidebar .nav-link {
    color: #94a3b8;
}

.sidebar .nav-link:hover, .sidebar .nav-link.active {
    background: var(--blue-50);
    color: var(--primary-color);
    font-weight: 600;
}

[data-bs-theme="dark"] .sidebar .nav-link:hover, [data-bs-theme="dark"] .sidebar .nav-link.active {
    background: rgba(14, 165, 233, 0.1);
    color: #38bdf8;
}

/* Dark mode generic overrides */
[data-bs-theme="dark"] body {
    background-color: #020617;
    color: #f1f5f9;
}

[data-bs-theme="dark"] .navbar-theme {
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
}

[data-bs-theme="dark"] .navbar-theme .navbar-brand, [data-bs-theme="dark"] .navbar-theme .nav-link {
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .navbar-theme a.nav-link::before {
    background-color: #38bdf8;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #0f172a !important;
}

[data-bs-theme="dark"] .card {
    background-color: #0f172a;
    border: 1px solid #1e293b;
}

[data-bs-theme="dark"] .glass-morphism {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.transition-all { transition: all 0.3s ease; }
.transition-colors { transition: color 0.3s ease, background-color 0.3s ease; }
.hover-up:hover { transform: translateY(-5px); transition: transform 0.2s ease; }
.animate-float { animation: float 3s ease-in-out infinite; }

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

[data-bs-theme="dark"] .text-dark {
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .text-theme {
    color: #38bdf8 !important;
}

[data-bs-theme="dark"] .text-secondary {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .btn-theme {
    background-color: #0ea5e9;
    border-color: #0ea5e9;
}

[data-bs-theme="dark"] .btn-theme:hover {
    background-color: #38bdf8;
    border-color: #38bdf8;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    color: #cbd5e1;
    border-color: #475569;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #334155;
    border-color: #475569;
    color: #f8fafc;
}

/* Standard Scrollbar Styling (Premium) */
html {
    scrollbar-gutter: stable;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--blue-200);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--blue-300);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #1e293b;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Responsive Navbar Overflow Menu (992px to 1300px) */
@media (min-width: 992px) and (max-width: 1300px) {
    .nav-desktop-collapse {
        display: none !important;
    }
    .nav-desktop-more {
        display: block !important;
    }
}
@media (min-width: 1300.01px) {
    .nav-desktop-collapse {
        display: block !important;
    }
    .nav-desktop-more {
        display: none !important;
    }
}
@media (max-width: 991.98px) {
    .nav-desktop-collapse {
        display: block !important;
    }
    .nav-desktop-more {
        display: none !important;
    }
}


/* Utility Classes */
.transition-all { transition: all 0.3s ease; }
.transition-colors { transition: color 0.3s ease, background-color 0.3s ease; }
.hover-up:hover { transform: translateY(-5px); transition: transform 0.2s ease; }
.animate-float { animation: float 3s ease-in-out infinite; }


/* Dark mode accordion */
[data-bs-theme="dark"] .accordion-item {
    background-color: #0f172a;
    border-color: #1e293b;
}

[data-bs-theme="dark"] .accordion-button {
    background-color: #0f172a;
    color: #f1f5f9;
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: rgba(14, 165, 233, 0.1);
    color: #38bdf8;
}

[data-bs-theme="dark"] .list-group-item {
    border-color: #1e293b;
    color: #94a3b8;
}

[data-bs-theme="dark"] .bg-blue-50 {
    background-color: rgba(14, 165, 233, 0.05) !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #020617 !important;
}


.shadow-hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.shadow-hover:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .shadow-hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .shadow-hover:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* SweetAlert Modern & Dark Mode Integration */
div:where(.swal2-container) div:where(.swal2-popup) {
    border-radius: 1.5rem !important;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif !important;
    padding: 1.5rem 2rem 2rem 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1) !important;
}
div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm {
    border-radius: 1rem !important;
    padding: 0.8rem 2.5rem !important;
    font-weight: 600 !important;
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3) !important;
    transition: all 0.3s ease !important;
}
div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(37, 99, 235, 0.4) !important;
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
}
div:where(.swal2-container) h2:where(.swal2-title) {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #1e293b;
}
div:where(.swal2-container) div:where(.swal2-html-container) {
    color: #64748b;
    font-size: 0.95rem !important;
    margin-top: 0.5em !important;
}

/* Dark Mode SweetAlert Override */
html[data-bs-theme="dark"] div:where(.swal2-container) div:where(.swal2-popup) {
    background-color: #1e293b !important;
    border: 1px solid #334155;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}
html[data-bs-theme="dark"] div:where(.swal2-container) h2:where(.swal2-title) {
    color: #f1f5f9 !important;
}
html[data-bs-theme="dark"] div:where(.swal2-container) div:where(.swal2-html-container) {
    color: #94a3b8 !important;
}
html[data-bs-theme="dark"] div:where(.swal2-icon).swal2-success [class^="swal2-success-line"] {
    background-color: #a5dc86 !important;
}
html[data-bs-theme="dark"] div:where(.swal2-icon).swal2-success .swal2-success-ring {
    border-color: rgba(165, 220, 134, 0.3) !important;
}
html[data-bs-theme="dark"] div:where(.swal2-icon).swal2-warning {
    border-color: #f8bb86 !important;
    color: #f8bb86 !important;
}
html[data-bs-theme="dark"] div:where(.swal2-icon).swal2-error {
    border-color: #f27474 !important;
    color: #f27474 !important;
}

/* SweetAlert Toast Override */
div:where(.swal2-container) div:where(.swal2-toast) {
    padding: 0.75rem 1rem !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}
div:where(.swal2-container) div:where(.swal2-toast) h2:where(.swal2-title) {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    margin: 0 !important;
}
html[data-bs-theme="dark"] div:where(.swal2-container) div:where(.swal2-toast) {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5) !important;
}
