﻿/* ===========================================================
Variables
=========================================================== */
:root {
    --company-color: #0d6efd;
    --brand: var(--company-color);
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --shadow-strong: 0 12px 28px rgba(0,0,0,.22);
    --shadow-medium: 0 8px 22px rgba(0,0,0,.16);
    --shadow-soft: 0 4px 12px rgba(0,0,0,.10);
}

/* ===========================================================
Base / Body / Logo
=========================================================== */
html, body {
    height: 100%;
}

body {
    min-height: 100vh;
}

#companyLogo {
    max-width: 110px;
    max-height: 52px;
    object-fit: contain;
}

/* ===========================================================
Background layers and animation
=========================================================== */
#background, #background-fade, #gradient-overlay {
    position: fixed;
    inset: 0;
    z-index: 0 !important;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

#background-fade {
    opacity: 0;
    z-index: -2 !important;
    transition: opacity 1s ease-in-out;
}

#gradient-overlay {
    background: linear-gradient(120deg, rgba(13,110,253,.45), rgba(111,66,193,.45), rgba(13,110,253,.45));
    background-size: 200% 200%;
    animation: gradientShift 12s ease-in-out infinite;
    mix-blend-mode: overlay;
    opacity: .75;
    z-index: -1;
    pointer-events: none;
}

@keyframes gradientShift {
    0%,100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@media (prefers-reduced-motion:reduce) {
    #gradient-overlay {
        animation: none;
    }
}

/* ===========================================================
Login / Glass
=========================================================== */
.login-card {
    backdrop-filter: blur(12px);
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    z-index: 2;
    animation: fadeInUp .6s ease;
    transition: background-color .3s, transform .3s, box-shadow .3s;
    box-shadow: var(--shadow-soft);
}

    .login-card:hover {
        transform: translateY(-5px) scale(1.01);
        box-shadow: 0 8px 22px rgba(13,110,253,.25), 0 4px 14px rgba(111,66,193,.18);
    }

.glass-reflection {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 52px;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
    background: linear-gradient(150deg,rgba(255,255,255,.05) 0%,rgba(255,255,255,.3) 45%,rgba(255,255,255,.8) 100%);
    opacity: .55;
    pointer-events: none;
}

/* ===========================================================
Floating inputs
=========================================================== */
.floating-input-group {
    position: relative;
    margin-bottom: 1.2rem;
}

.floating-input {
    width: 100%;
    padding: 10px 12px 8px;
    border-radius: 8px;
    border: 1px solid rgba(150,150,150,.35);
    transition: all .3s;
    outline: none;
    font-size: .95rem;
}

    .floating-input:focus {
        border-color: var(--brand);
        box-shadow: 0 0 8px rgba(13,110,253,.25);
    }

.floating-label {
    position: absolute;
    left: 14px;
    top: 11px;
    font-size: .95rem;
    color: rgba(120,120,120,.65);
    pointer-events: none;
    transition: all .25s;
}

.floating-input:focus ~ .floating-label,
.floating-input:not(:placeholder-shown) ~ .floating-label {
    top: -8px;
    left: 11px;
    font-size: .82rem;
    font-weight: 500;
    color: var(--brand);
    background: linear-gradient(to bottom, var(--bs-body-bg) 60%, transparent 100%);
    padding: 0 6px;
    border-radius: 4px;
}

/* ===========================================================
Captcha block
=========================================================== */
.captcha-glass-auto {
    padding: 12px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,.35);
    box-shadow: 0 4px 18px rgba(0,0,0,.12);
    margin-bottom: 1rem;
    transition: all .4s;
}

.captcha-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.captcha-container {
    flex: 0 0 120px;
    max-width: 150px;
}

.captcha-image {
    width: 100%;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.1);
    background-color: #fff;
    transition: opacity .4s;
}

    .captcha-image.fade-refresh {
        opacity: 0;
    }

.captcha-input {
    flex: 1;
    text-align: center;
    border-radius: 8px;
    height: 42px;
}

.captcha-actions {
    display: flex;
    justify-content: center;
    gap: 5px;
}

    .captcha-actions button {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background .3s, transform .3s;
    }

        .captcha-actions button:hover {
            background-color: rgba(13,110,253,.15);
            transform: scale(1.1);
        }

/* ===========================================================
Light / Dark themes
=========================================================== */
[data-bs-theme=light] body {
    background-color: #f8f9fa;
    color: #212529;
}

[data-bs-theme=dark] body {
    background-color: #121212;
    color: #f8f9fa;
}

[data-bs-theme=light] .login-card {
    background-color: rgba(255,255,255,.95);
}

[data-bs-theme=dark] .login-card {
    background-color: rgba(33,37,41,.92);
}

[data-bs-theme=light] .card-header {
    background-color: var(--brand);
    color: #fff;
}

[data-bs-theme=dark] .card-header {
    background-color: #23272b;
    color: #f8f9fa;
}

[data-bs-theme=light] .floating-input {
    background-color: #fff;
    color: #212529;
}

[data-bs-theme=dark] .floating-input {
    background-color: #1e1e1e;
    color: #f1f3f5;
    border-color: rgba(180,180,180,.25);
}

[data-bs-theme=dark] .floating-label {
    color: rgba(200,200,200,.65);
}

[data-bs-theme=dark] .floating-input:focus {
    border-color: #66b2ff;
    box-shadow: 0 0 10px rgba(77,163,255,.35);
}

    [data-bs-theme=dark] .floating-input:focus ~ .floating-label,
    [data-bs-theme=dark] .floating-input:not(:placeholder-shown) ~ .floating-label {
        background-color: rgba(33,37,41,.9);
        color: #66b2ff;
    }

/* Captcha dark */
[data-bs-theme=dark] .captcha-glass-auto {
    background: rgba(40,40,55,.45);
    box-shadow: 0 4px 22px rgba(0,0,0,.45);
}

[data-bs-theme=dark] .captcha-image {
    border-color: rgba(255,255,255,.25);
    background-color: rgba(30,30,30,.6);
}

/* Contrast tweaks */
.text-muted {
    color: rgba(60,60,60,.8) !important;
}

[data-bs-theme=dark] .text-muted {
    color: rgba(230,230,230,.75) !important;
}

.text-danger, .field-validation-error {
    color: var(--danger-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.input-validation-error {
    border-color: var(--danger-color) !important;
}

[data-bs-theme=dark] .text-dark, [data-bs-theme=dark] .text-body,
[data-bs-theme=dark] h4.text-dark, [data-bs-theme=dark] h5.text-dark {
    color: #f8f9fa !important;
}

/* ===========================================================
Buttons + Ripple
=========================================================== */
.btn {
    position: relative;
    overflow: hidden;
    transition: transform .1s, box-shadow .2s;
}

    .btn:active {
        transform: scale(.97);
    }

.btn-primary {
    background: linear-gradient(90deg, var(--brand), rgba(111,66,193,1));
    border: none;
    color: #fff;
}

    .btn-primary:hover {
        opacity: .92;
        box-shadow: 0 4px 14px rgba(13,110,253,.25);
    }

.btn-outline-dark:hover {
    background-color: var(--brand);
    color: #fff;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: rippleEffect .6s linear;
    background-color: rgba(255,255,255,.6);
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===========================================================
Sidebar (Desktop full-hide via .mini, Mobile slide-in via .active)
=========================================================== */
#sidebar {
    width: 260px;
    transition: all .3s;
    background-color: var(--bs-body-bg);
    z-index: 1045;
    box-shadow: var(--shadow-soft);
}

    /* Legacy compact mini (if you still need hover-expand, keep and let final overrides win) */
    #sidebar.mini {
        width: 80px;
    }

        #sidebar.mini .nav-link span,
        #sidebar.mini .collapse,
        #sidebar.mini .dropdown,
        #sidebar.mini form,
        #sidebar.mini hr,
        #sidebar.mini .form-check-label,
        #sidebar.mini .dropdown-toggle::after {
            display: none !important;
        }

        #sidebar.mini .nav-link {
            text-align: center;
            padding: .6rem 0;
        }

            #sidebar.mini .nav-link i {
                margin: 0 !important;
                font-size: 1.2rem;
            }

/* Desktop hover-expand (optional; will be overridden by full-hide when .mini active) */
@media (min-width:992px) {
    #sidebar.mini:hover {
        width: 260px;
        box-shadow: 0 4px 12px rgba(0,0,0,.15);
        position: relative;
        z-index: 1050;
    }

        #sidebar.mini:hover .nav-link span,
        #sidebar.mini:hover .collapse,
        #sidebar.mini:hover .dropdown,
        #sidebar.mini:hover form,
        #sidebar.mini:hover hr,
        #sidebar.mini:hover .form-check-label {
            display: inline !important;
        }

        #sidebar.mini:hover .nav-link {
            text-align: start;
            padding-left: 12px !important;
        }
}

/* Overlay for mobile slide-in */
#sidebarOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    opacity: 0;
    visibility: hidden;
    transition: all .3s;
    z-index: 1040;
}

    #sidebarOverlay.active {
        opacity: 1;
        visibility: visible;
    }

/* Content shift */
#mainContent {
    transition: margin-inline-start .3s, margin-left .3s, margin-right .3s;
}

/* Default desktop content margins for visible sidebar */
@media (min-width:992px) {
    html[dir="ltr"] #sidebar:not(.mini):not(.hide) + #mainContent {
        margin-left: 260px;
    }

    html[dir="rtl"] #sidebar:not(.mini):not(.hide) + #mainContent {
        margin-right: 260px;
    }
}

/* Mobile drawer */
@media (max-width:991.98px) {
    #sidebar {
        position: fixed;
        top: 0;
        inset-inline-start: 0;
        height: 100%;
        transform: translateX(-100%);
        width: 260px !important;
    }

    html[dir="rtl"] #sidebar {
        transform: translateX(100%);
        inset-inline-start: auto;
        inset-inline-end: 0;
    }

    #sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 12px rgba(0,0,0,.3);
    }

    /* Mini has no meaning on mobile; keep it off-screen */
    #sidebar.mini {
        transform: translateX(-100%) !important;
    }

    html[dir="rtl"] #sidebar.mini {
        transform: translateX(100%) !important;
    }
}

/* Neutralize legacy .hide */
#sidebar.hide {
    transform: none;
    opacity: 1;
    visibility: visible;
}

/* Links styling */
/* Clean icon + label layout in wide sidebar */
.sidebar-links .nav-link {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: 1.07rem;
    min-height: 2.6rem;
    padding: .48rem .85rem;
    border-radius: .375rem;
    transition: .25s;
    white-space: nowrap; /* prevent wrapping; remove if you prefer wrap */
}

    .sidebar-links .nav-link i,
    .sidebar-links .nav-link .fa {
        font-size: 1.14rem;
        width: 1.7rem; /* align icons */
        text-align: center;
    }

/* ===========================================================
Animations & utilities
=========================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-fade-toast {
    opacity: 0;
    transform: translate(20px,20px);
    transition: opacity .4s, transform .4s;
}

    .slide-fade-toast.show {
        opacity: 1;
        transform: translate(0,0);
    }

.spinner-border.fade-in {
    animation: fadeIn .3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===========================================================
Forms & validation
=========================================================== */
.validation-summary-errors, .alert-validation {
    border: 1px solid rgba(220,53,69,.28);
    background: rgba(220,53,69,.06);
    color: var(--danger-color);
    border-radius: .5rem;
    padding: .5rem .75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .15rem rgba(13,110,253,.25);
}

/* ===========================================================
Tables & print
=========================================================== */
.table thead th {
    white-space: nowrap;
}

@media print {
    .btn, .card-header .btn, .nav, .navbar, #sidebar, #sidebarOverlay, #showMenuBtn {
        display: none !important;
    }

    #mainContent {
        margin: 0 !important;
    }
}

/* ===========================================================
Responsive tweaks
=========================================================== */
@media (max-width:576px) {
    .captcha-row {
        flex-direction: column;
        gap: 7px;
    }

    .captcha-container, .captcha-image, .captcha-input {
        width: 100%;
    }

    .login-card {
        border-radius: .75rem;
    }
}

/* ===========================================================
Charts
=========================================================== */
canvas {
    max-width: 100%;
    height: auto;
}

/* ===========================================================
Footer
=========================================================== */
footer {
    background-color: transparent;
}

[data-bs-theme=dark] footer {
    background-color: transparent;
}

/* ===========================================================
Utilities
=========================================================== */
.shadow-strong {
    box-shadow: var(--shadow-strong) !important;
}

.shadow-medium {
    box-shadow: var(--shadow-medium) !important;
}

.shadow-soft {
    box-shadow: var(--shadow-soft) !important;
}

.rounded-8 {
    border-radius: .5rem !important;
}

.rounded-12 {
    border-radius: .75rem !important;
}

.rounded-16 {
    border-radius: 1rem !important;
}






