/* Theme Colors: Red, Black, White, Yellow */
:root {
    --theme-red: #d90429;
    --theme-red-dark: #b8031f;
    --theme-yellow: #ffb703;
    --theme-gray: #f4f4f4;

    /* Light Mode Defaults */
    --bg-main: #f4f6f9;
    --text-main: #212529;
    --text-muted: #6c757d;

    --card-bg: rgba(255, 255, 255, 0.95);
    --header-bg: rgba(255, 255, 255, 0.90);
    --header-text: #212529;

    --glass-border: rgba(0, 0, 0, 0.08);

    --grad-c1: #ffffff;
    --grad-c2: #f4f6f9;
    --grad-c3: #e9ecef;
    --grad-c4: #dee2e6;

    --sop-bg: rgba(255, 255, 255, 0.95);
    --sop-text: #212529;
    --sop-border: var(--theme-red);
    --sop-title: var(--theme-red);

    --overlay-opacity: 0.1;
    --icon-wrap-bg: rgba(0, 0, 0, 0.04);
    --modal-bg: #ffffff;
    --user-name-color: var(--theme-red);

    /* Modals and inputs */
    --input-bg: transparent;
    --login-glass-top-bg: #ffffff;
}

[data-theme="dark"] {
    /* Dark Mode Theme */
    --bg-main: #121212;
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;

    --card-bg: rgba(30, 30, 30, 0.95);
    --header-bg: rgba(18, 18, 18, 0.95);
    --header-text: #f8f9fa;

    --glass-border: rgba(255, 255, 255, 0.1);

    --grad-c1: #080808;
    --grad-c2: #b8031f;
    --grad-c3: #1a1a1a;
    --grad-c4: #080808;

    --sop-bg: rgba(25, 25, 25, 0.95);
    --sop-text: #f8f9fa;
    --sop-border: var(--theme-yellow);
    --sop-title: var(--theme-yellow);

    --overlay-opacity: 0.25;
    --icon-wrap-bg: rgba(255, 255, 255, 0.08);
    --modal-bg: #212529;
    --user-name-color: var(--theme-yellow);

    --input-bg: rgba(255, 255, 255, 0.05);
    --login-glass-top-bg: #1a1a1a;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.guest-body {
    background-color: var(--bg-main);
}

/* Handle White Logo depending on Theme Mode */
.brand-logo img,
.brand-logo-large img {
    transition: filter 0.3s ease, transform 0.3s ease;
}

html:not([data-theme="dark"]) .brand-logo img,
html:not([data-theme="dark"]) .brand-logo-large img {
    filter: invert(1) opacity(0.85);
    /* Black equivalent */
}

html[data-theme="dark"] .brand-logo-large img {
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.6));
}

/* Background Setup */
.bg-interactive {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background: linear-gradient(-45deg, var(--grad-c1), var(--grad-c2), var(--grad-c3), var(--grad-c4));
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    transition: background 0.5s ease;
}

.bg-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: url('../images/bg-header-admin.jpeg') no-repeat center center;
    background-size: cover;
    opacity: var(--overlay-opacity);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

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

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

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: var(--theme-yellow);
    border-radius: 50%;
    opacity: 0.5;
    animation: floatParticle linear infinite;
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(-10vh) scale(1.5);
        opacity: 0;
    }
}

/* Top Navigation Area */
.hero-header {
    position: relative;
    /* padding: 1.2rem 0; */
    background: var(--header-bg);
    color: var(--header-text);
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid var(--theme-red);
    z-index: 10;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.hero-header .brand-logo img {
    height: 64px;
    object-fit: contain;
}

.hero-header .brand-logo img:hover {
    transform: scale(1.05);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--header-text);
    justify-content: flex-end;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
    color: var(--user-name-color);
    line-height: 1.2;
}

.user-outlet {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    font-weight: 500;
}

.nav-actions {
    display: flex;
    gap: 10px;
}

.nav-icon {
    background: var(--icon-wrap-bg);
    border: 1px solid var(--glass-border);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--header-text);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    text-decoration: none;
}

.nav-icon:hover {
    background: var(--theme-red);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(217, 4, 41, 0.4);
    border-color: var(--theme-red);
}

.bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--theme-yellow);
    color: #000;
    font-size: 0.6rem;
    font-weight: bold;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(255, 183, 3, 0.5);
}

/* Layout Container Options */
.content-wrapper {
    padding: 40px 0;
    position: relative;
    z-index: 5;
}

/* Modules Section - Smaller & More Elegant */
.module-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-decoration: none !important;
    backdrop-filter: blur(10px);
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--theme-red);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.module-card:hover {
    transform: translateY(-5px);
    background: var(--card-bg);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
    border-color: transparent;
}

.module-card:hover::before {
    transform: scaleX(1);
}

.module-icon-wrap {
    width: 50px;
    height: 50px;
    margin: 0 auto 10px;
    background: var(--icon-wrap-bg);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.module-card:hover .module-icon-wrap {
    background: rgba(217, 4, 41, 0.08);
    /* slight red tint */
    transform: scale(1.05) rotate(5deg);
    border-radius: 50%;
}

.module-card img {
    max-height: 25px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.module-card:hover img {
    filter: drop-shadow(0 2px 4px rgba(217, 4, 41, 0.3));
}

.module-title {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
    margin: 0;
    transition: color 0.3s ease;
}

.module-card:hover .module-title {
    color: var(--theme-red);
}

.module-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(1);
}

.module-card.disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border-color: var(--glass-border);
}

.module-card.disabled:hover::before {
    transform: scaleX(0);
}

/* SOP Section */
.sop-section {
    background: var(--sop-bg);
    border-radius: 16px;
    padding: 25px;
    color: var(--sop-text);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--sop-border);
    backdrop-filter: blur(15px);
    height: 100%;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-top: 4px solid var(--sop-border);
    transition: all 0.3s ease;
}

.sop-section::after {
    content: '📝';
    position: absolute;
    right: -15px;
    bottom: -15px;
    font-size: 100px;
    opacity: 0.05;
    z-index: 0;
}

.sop-content {
    position: relative;
    z-index: 1;
}

.sop-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
    gap: 12px;
}

.sop-title {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--sop-title);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sop-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sop-list li {
    padding: 12px 0;
    border-bottom: 1px dashed var(--glass-border);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.85rem;
    transition: transform 0.2s ease, color 0.2s ease;
    line-height: 1.4;
}

.sop-list li:hover {
    transform: translateX(5px);
    color: var(--theme-red);
    /* Highlight on hover instead of white to support light mode */
}

.sop-list li:last-child {
    border-bottom: none;
}

.sop-icon {
    color: var(--theme-red);
    margin-top: 2px;
    font-size: 1rem;
}

/* Guest Login Mode - Full Screen Wrapper */
.guest-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.guest-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    z-index: 5;
}

.brand-logo-large {
    text-align: center;
    margin-bottom: 10px;
}

.brand-logo-large img {
    width: 180px;
}

.login-glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

.login-glass-top {
    background: var(--login-glass-top-bg);
    padding: 25px 30px;
    text-align: center;
    position: relative;
}

.login-glass-top::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--theme-red), var(--theme-yellow));
}

.login-glass-body {
    padding: 30px;
    background: transparent;
}

.form-control-custom {
    background: var(--input-bg);
    color: var(--text-main);
    border-radius: 10px;
    border: 1.5px solid var(--glass-border);
    padding: 10px 14px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.form-control-custom::placeholder {
    color: var(--text-muted);
}

.form-control-custom:focus {
    border-color: var(--theme-red);
    box-shadow: 0 0 0 4px rgba(217, 4, 41, 0.1);
    background: var(--input-bg);
    color: var(--text-main);
}

.input-group-text-custom {
    border-radius: 10px;
    border: 1.5px solid var(--glass-border);
    background: var(--icon-wrap-bg);
    color: var(--text-muted);
}

.btn-theme-red {
    background: linear-gradient(135deg, var(--theme-red), var(--theme-red-dark));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    padding: 12px;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(217, 4, 41, 0.25);
    width: 100%;
    display: block;
    text-align: center;
}

.btn-theme-red:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(217, 4, 41, 0.35);
    color: #fff;
}

/* Theme Toggle Global positioned class for Guest */
.theme-toggle-guest {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    background: var(--icon-wrap-bg);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle-guest:hover {
    background: var(--theme-red);
    color: #fff;
    transform: translateY(-2px);
}

/* Modal Position Top Right */
.modal-top-right .modal-dialog {
    position: absolute;
    top: 20px;
    right: 20px;
    margin: 0;
    width: 320px;
    max-width: calc(100vw - 40px);
}

@media (max-width: 576px) {
    .modal-top-right .modal-dialog {
        right: 15px;
        top: 15px;
        max-width: calc(100vw - 30px);
    }
}

/* Modals Customization */
.modal-content {
    background-color: var(--modal-bg);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    background: var(--header-bg);
    color: var(--header-text);
    border-bottom: 3px solid var(--theme-red);
    padding: 15px 20px;
}

/* Preserve user's bg-warning */
.modal-header.bg-warning {
    background: var(--theme-yellow) !important;
    /* override bootstrap if any issues */
    border-bottom: none;
    color: #1a1a1a;
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Button Close Filter Logic for theme */
html[data-theme="dark"] .btn-close {
    filter: invert(1);
}

/* Exclude the bg-warning modal from white close buttons if applicable, but default btn-close is dark */
html[data-theme="dark"] .modal-header.bg-warning .btn-close {
    filter: none;
}

/* Notification List styling */
.notif-list {
    max-height: 350px;
    overflow-y: auto;
}

.notif-item {
    padding: 12px 15px;
    border-left: 3px solid var(--theme-red);
    background: var(--icon-wrap-bg);
    margin-bottom: 12px;
    border-radius: 0 8px 8px 0;
    transition: all 0.2s ease;
}

.notif-item:hover {
    background: var(--card-bg);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.notif-item.unread {
    border-left-color: var(--theme-yellow);
    background: rgba(255, 183, 3, 0.08);
    /* slight yellow tint */
}

.notif-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 3px;
}

.notif-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    line-height: 1.3;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.notif-time i {
    font-size: 0.75rem;
}

/* Footer */
.footer-custom {
    /* background: var(--header-bg); */
    color: var(--text-muted);
    padding: 15px 0;
    text-align: center;
    font-size: 0.8rem;
    /* border-top: 1px solid var(--glass-border); */
    position: relative;
    z-index: 5;
}

/* Loading Animations */
@keyframes smoothBounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 2px 4px rgba(217, 4, 41, 0.3));
    }

    50% {
        transform: translateY(-8px) scale(1.15);
        filter: drop-shadow(0 8px 15px rgba(217, 4, 41, 0.6));
    }
}

@keyframes pulseBlur {

    0%,
    100% {
        filter: blur(0px);
        opacity: 1;
    }

    50% {
        filter: blur(2px);
        opacity: 0.6;
    }
}

.module-card.is-loading .module-icon-wrap img {
    animation: smoothBounce 0.6s infinite cubic-bezier(0.455, 0.030, 0.515, 0.955);
}

.module-card.is-loading .module-title {
    animation: pulseBlur 0.6s infinite ease-in-out;
}