@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2fcc71;
    --primary-hover: #27ae60;
    --bg-dark: #121212;
    --sidebar-bg: rgba(30, 30, 35, 0.85);
    --header-bg: rgba(255, 255, 255, 0.75);
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --card-radius: 12px;
}

html,
body {
    font-family: 'Inter', sans-serif !important;
    background-color: #f4f7f6 !important;
    color: var(--text-main);
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
}

#wrap {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    /* Fix animsition conflict: the animsition CSS sets opacity:0 on .animsition
       but the plugin fails to animate back to visible due to jQuery load order in
       the reserva view. This override ensures content is always visible. */
    opacity: 1 !important;
}

/* Fix animsition loading spinner that gets stuck covering the entire page
   when the animsition plugin fails to initialize (due to jQuery conflicts) */
.animsition-loading {
    display: none !important;
}

/* Force .animsition elements to be visible - the animsition CSS sets opacity:0
   but the plugin fails to animate back due to jQuery load order conflicts */
.animsition {
    opacity: 1 !important;
}


/* Glassmorphism Header */
#header {
    background: var(--header-bg) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    height: 60px;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#header .branding {
    background: transparent !important;
    width: 240px;
    height: 60px;
    display: flex;
    align-items: center;
    padding-left: 20px;
}

#header .branding .brand span {
    color: var(--primary-color) !important;
    font-size: 20px;
    letter-spacing: 1px;
}

/* Sidebar Modernization */
#sidebar {
    background: var(--sidebar-bg) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    position: fixed;
    /* Essential to avoid double margin */
    top: 60px;
    left: 0;
    height: calc(100vh - 60px);
    width: 240px;
    padding-top: 15px;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#navigation {
    list-style: none;
    padding: 0 15px;
}

#navigation>li {
    margin-bottom: 5px;
}

#navigation>li>a {
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 14px 18px !important;
    display: flex;
    align-items: center;
    border-radius: 12px;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

#navigation>li>a span {
    overflow: hidden;
    text-overflow: ellipsis;
}

#navigation .badge {
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-left: auto;
}

#navigation>li>a i {
    font-size: 18px;
    margin-right: 15px;
    width: 24px;
    text-align: center;
    opacity: 0.8;
    transition: transform 0.25s ease;
}

#navigation>li>a:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    transform: translateX(5px);
}

#navigation>li>a:hover i {
    opacity: 1;
    transform: scale(1.1);
}

#navigation>li.active>a {
    background: var(--primary-color) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(47, 204, 113, 0.35);
}

#navigation>li.active>a i {
    opacity: 1;
    transform: scale(1.1);
}

#navigation>li>a {
    font-size: 15px;
    /* Slightly larger for the expanded menu */
    font-weight: 500;
}

/* Sidebar Title/Header */
#sidebar .panel-heading {
    padding: 10px 25px !important;
    background: transparent !important;
    border: none !important;
}

#sidebar .panel-title a {
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    text-decoration: none !important;
}

/* Mini Sidebar overrides for .sidebar-sm-forced */
.sidebar-sm-forced #sidebar {
    width: 60px !important;
}

.sidebar-sm-forced #sidebar #navigation {
    padding: 0 5px;
}

.sidebar-sm-forced #sidebar #navigation>li>a {
    padding: 12px 0 !important;
    justify-content: center;
}

.sidebar-sm-forced #sidebar #navigation>li>a i {
    margin-right: 0;
    font-size: 20px;
}

.sidebar-sm-forced #sidebar #navigation>li>a span {
    display: none;
}

.sidebar-sm-forced #sidebar #navigation>li.active>a {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--primary-color) !important;
    box-shadow: none;
}

.sidebar-sm-forced #sidebar #navigation>li.active>a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 3px;
    background: var(--primary-color);
}

/* Page Content Refining - Override legacy absolute positioning from main.css */
#content {
    position: fixed !important;
    top: 60px !important;
    left: 240px !important;
    right: 0 !important;
    bottom: 0 !important;
    padding-top: 20px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-bottom: 20px !important;
    margin: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #f4f7f6;
}

.page,
.page-sidebar-xs-layout {
    padding: 0 !important;
    margin: 0 !important;
}

#content .page>div,
#content .page>section {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.sidebar-sm-forced #content {
    left: 60px !important;
}

@media (max-width: 768px) {
    #content {
        left: 0 !important;
    }

    #sidebar {
        left: -250px;
        transition: left 0.3s ease;
    }

    .appWrapper.sidebar-open #sidebar {
        left: 0;
    }
}

/* Card & Tile Styling */
.tile {
    background: #fff;
    border-radius: var(--card-radius) !important;
    border: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    transition: transform 0.2s ease;
}

.tile:hover {
    transform: translateY(-2px);
}

.tile-header {
    border-bottom: 1px solid #f0f0f0 !important;
    padding: 15px 20px !important;
}

.tile-header h1,
.tile-header h2 {
    font-weight: 600 !important;
    color: var(--text-main);
}

/* Modern Buttons BS5 compat */
.btn-primary {
    background-color: var(--primary-color) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 20px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
}

/* Modal BS5 refine */
.modal-content {
    border-radius: 15px !important;
    border: none !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 20px !important;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 15px 20px !important;
}

/* Sidebar Nav BS5 refine */
#navigation {
    list-style: none;
    padding-left: 0;
}

#navigation ul {
    list-style: none;
    padding-left: 20px;
}

/* Login Page Premium Styling */
.page-login {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    min-height: 100vh;
}

.page-login .card {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.page-login .card-header {
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 40px 30px;
}

.page-login .card-content {
    padding: 30px;
}

.page-login .form-control {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border-radius: 12px;
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.page-login .form-control:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px rgba(47, 204, 113, 0.2) !important;
}

.page-login .form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.page-login .btn-primary {
    background-color: var(--primary-color) !important;
    border: none !important;
    font-weight: 700 !important;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 10px 20px rgba(47, 204, 113, 0.2);
}

.page-login .btn-primary:hover {
    background-color: var(--primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(47, 204, 113, 0.3);
}

/* Global Card & Table refinements */
.card {
    border: none;
    box-shadow: var(--glass-shadow);
    border-radius: var(--card-radius);
}

.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

/* Fix for nested lists in BS5 sidebar */
#sidebar ul {
    margin-bottom: 0;
}

/* Reset BS5 default list padding for sidebar */
#sidebar .panel-body {
    padding: 0 !important;
}

/* Adjustments for BS5 layout */
.appWrapper {
    overflow-x: hidden;
}

#wrap {
    display: block !important;
}