﻿/* ========================================
   VoxFreezer Modern Design System
   Sidebar Layout Edition
   ======================================== */

/* CSS Custom Properties */
:root {
    /* Colors */
    --color-primary: #3092e5;
    --color-primary-dark: #004dc2;
    --color-primary-light: #3d8bfd;

    /* Sidebar Theme */
    --sidebar-bg: #1e2a3a;
    --sidebar-bg-hover: #2d3e50;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-accent: #3092e5;
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 56px;

    /* Content */
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;

    /* Typography */
    --font-family: 'Segoe UI', 'Roboto', -apple-system, sans-serif;
    --font-size-base: 15px;
    --font-size-lg: 16px;
    --font-size-sm: 13px;

    /* Effects */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --transition: 0.2s ease;
}

/* ========================================
   Base Layout
   ======================================== */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text);
    line-height: 1.6;
    background-color: var(--content-bg);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Remove background images when using sidebar layout */
body.sidebar-layout {
    background-image: none !important;
    padding-top: 0;
}

/* ========================================
   Sidebar Navigation
   ======================================== */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    /* Custom Scrollbar - Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Custom Scrollbar - WebKit (Chrome, Edge, Safari) */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   Global custom scrollbar
   Applies to the whole system. The more specific .sidebar rules
   above keep the sidebar's thin/dark look intact.

   NOTE: do NOT set `scrollbar-color` / `scrollbar-width` on html/body
   for Chromium — when both the standard props and ::-webkit-scrollbar
   rules are present, Chrome prefers the OS "modern" scrollbar and
   discards the webkit styles entirely. We restrict those to Firefox.
   ============================================================ */
@supports (-moz-appearance: none) {
    html {
        scrollbar-width: auto;
        scrollbar-color: #94a3b8 var(--content-bg);
    }
}

*::-webkit-scrollbar {
    width: 20px;
    height: 20px;
}

*::-webkit-scrollbar-track {
    background: var(--content-bg);
    border-radius: 2px;
    box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.04);
}

*::-webkit-scrollbar-thumb {
    background-color: #94a3b8;
    background-image: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.12) 0%,
        rgba(255, 255, 255, 0.08) 35%,
        rgba(255, 255, 255, 0.08) 65%,
        rgba(0, 0, 0, 0.12) 100%
    );
    border-radius: 2px;
    border: 3px solid var(--content-bg);
    background-clip: padding-box;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35),
                inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

*::-webkit-scrollbar-thumb:hover {
    background-color: #64748b;
}

*::-webkit-scrollbar-thumb:active {
    background-color: #475569;
}

/* Horizontal scrollbars: rotate the gradient so the shading reads top/bottom */
*::-webkit-scrollbar-thumb:horizontal {
    background-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.12) 0%,
        rgba(255, 255, 255, 0.08) 35%,
        rgba(255, 255, 255, 0.08) 65%,
        rgba(0, 0, 0, 0.12) 100%
    );
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.35),
                inset -1px 0 0 rgba(0, 0, 0, 0.18);
}

*::-webkit-scrollbar-corner {
    background: var(--content-bg);
}

/* Explicit overrides for known scroll containers — defensive in case some
   component ships its own ::-webkit-scrollbar rules that outweigh *:: */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.dataTables_scrollBody::-webkit-scrollbar,
.dt-scroll-body::-webkit-scrollbar,
.datatable-flex-container::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.modal-body2::-webkit-scrollbar {
    width: 20px;
    height: 20px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.dataTables_scrollBody::-webkit-scrollbar-thumb,
.dt-scroll-body::-webkit-scrollbar-thumb,
.datatable-flex-container::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.modal-body2::-webkit-scrollbar-thumb {
    background-color: #94a3b8;
    background-image: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.12) 0%,
        rgba(255, 255, 255, 0.08) 35%,
        rgba(255, 255, 255, 0.08) 65%,
        rgba(0, 0, 0, 0.12) 100%
    );
    border-radius: 8px;
    border: 3px solid var(--content-bg);
    background-clip: padding-box;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35),
                inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.dataTables_scrollBody::-webkit-scrollbar-track,
.dt-scroll-body::-webkit-scrollbar-track,
.datatable-flex-container::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.modal-body2::-webkit-scrollbar-track {
    background: var(--content-bg);
    border-radius: 2px;
}

/* Logo/Brand Area */
.sidebar-brand {
    padding: 20px 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: var(--sidebar-text-active);
    transition: background var(--transition);
}

.sidebar-brand:hover {
    background: var(--sidebar-bg-hover);
    text-decoration: none;
    color: var(--sidebar-text-active);
}

.sidebar-brand i {
    font-size: 24px;
    color: var(--color-primary-light);
}

.sidebar-brand-text {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Menu Items */
.sidebar-item {
    margin: 2px 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 500;
    transition: all var(--transition);
}

.sidebar-link:hover {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--sidebar-accent);
    color: var(--sidebar-text-active);
}

.sidebar-link i {
    width: 22px;
    font-size: 18px;
    text-align: center;
    opacity: 0.85;
}

.sidebar-link:hover i,
.sidebar-link.active i {
    opacity: 1;
}

/* Master-Only Shield Indicator */
.sidebar-item.master-only .sidebar-link > i:first-child {
    position: relative;
}

.sidebar-item.master-only .sidebar-link > i:first-child::after {
    content: '\f3ed'; /* fa-shield-halved */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 8px;
    position: absolute;
    bottom: -3px;
    right: -6px;
    color: #f59e0b;
    opacity: 0.85;
    filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4));
    transition: all 0.2s ease;
    line-height: 1;
}

.sidebar-item.master-only .sidebar-link:hover > i:first-child::after,
.sidebar-item.master-only .sidebar-link.active > i:first-child::after {
    opacity: 1;
    color: #fbbf24;
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.6));
}

/* Menu Section Headers */
.sidebar-section {
    padding: 20px 20px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--sidebar-text);
    opacity: 0.5;
}

/* Collapsible Submenus */
.sidebar-submenu-toggle {
    cursor: pointer;
    position: relative;
}

.sidebar-submenu-toggle::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 16px;
    transition: transform var(--transition);
    opacity: 0.6;
}

.sidebar-submenu-toggle.open::after {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    padding-left: 20px;
    margin-top: 4px;
}

.sidebar-submenu.show {
    display: block;
}

.sidebar-submenu .sidebar-link {
    padding: 10px 16px;
    font-size: 14px;
    color: var(--sidebar-text);
    opacity: 0.85;
}

.sidebar-submenu .sidebar-link:hover {
    opacity: 1;
    background: var(--sidebar-bg-hover);
}

/* User Info / Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text);
    font-size: var(--font-size-sm);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--sidebar-bg-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-text-active);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    color: var(--sidebar-text-active);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 12px;
    opacity: 0.7;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 8px 0;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition);
}

.sidebar-logout:hover {
    background: rgba(220, 53, 69, 0.15);
    color: #ff6b6b;
    text-decoration: none;
}

/* ========================================
   Main Content Area
   ======================================== */

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    max-width: calc(100vw - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    background: var(--content-bg);
    overflow-x: hidden;
}

/* Top Header */
.main-header {
    background: var(--card-bg);
    padding: 16px 30px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Content Container */
.main-content {
    flex: 1;
    padding: 24px 30px;
}

.content-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    overflow-x: auto;
}

@media (max-width: 768px) {
    .content-card {
        padding: 16px 8px;
    }
}

/* Footer */
.main-footer {
    padding: 20px 30px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    border-top: 1px solid var(--color-border);
    background: var(--card-bg);
}

/* ========================================
   Modern Form Controls
   ======================================== */

.form-control {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 6px 12px;
    font-size: var(--font-size-base);
    line-height: 1.5;
    height: auto;
    min-height: 36px;
    transition: all var(--transition);
    background-color: var(--card-bg);
    color: var(--color-text);
    vertical-align: middle;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 97, 242, 0.15);
    outline: none;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-text);
    font-size: var(--font-size-sm);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px !important;
    cursor: pointer;
}

/* Ensure proper display in various contexts */
.header-actions .form-control,
.main-header .form-control {
    min-height: 36px;
    height: 36px;
}

/* ========================================
   Modern Buttons
   ======================================== */

.btn {
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-weight: 600;
    font-size: var(--font-size-base);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: none;
}

.btn-primary,
.btn-primary-modern {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover,
.btn-primary-modern:hover {
    background: var(--color-primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary,
.btn-secondary-modern {
    background: var(--card-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover,
.btn-secondary-modern:hover {
    background: var(--content-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-default {
    background: var(--content-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
}

.btn-default:hover {
    background: #e2e8f0;
}

/* ========================================
   Tables
   ======================================== */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table thead th {
    background: var(--content-bg);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-border);
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(0, 97, 242, 0.03);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   Modals - Overriding Bootstrap 3
   ======================================== */

.modal-content {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    /* Flexbox architecture for resizing/scaling */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 150px);
}

/* Force flexbox layout on modal-header, disable Bootstrap clearfix */
.modal .modal-header {
    background: var(--sidebar-bg) !important;
    color: var(--sidebar-text-active) !important;
    padding: 16px 24px !important;
    border: none !important;
    border-bottom: none !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 60px;
}

/* Disable Bootstrap 3 clearfix hack */
.modal .modal-header:before,
.modal .modal-header:after {
    display: none !important;
    content: none !important;
}

/* Modal title - left aligned */
.modal .modal-header .modal-title,
.modal .modal-header .modal-title2,
.modal .modal-header h4,
.modal .modal-header h5 {
    font-weight: 600 !important;
    font-size: 2rem !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 1 1 auto !important;
    line-height: 1.3 !important;
    color: var(--sidebar-text-active) !important;
    text-align: left !important;
}

/* Close button - right aligned, override Bootstrap float */
.modal .modal-header .close,
.modal .modal-header button.close {
    float: none !important;
    position: static !important;
    color: var(--sidebar-text-active) !important;
    opacity: 0.7 !important;
    text-shadow: none !important;
    font-size: 3rem !important;
    font-weight: 300 !important;
    padding: 0 !important;
    margin: 0 !important;
    margin-left: 16px !important;
    margin-top: 0 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 50% !important;
    transition: all 0.15s ease !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
}

.modal .modal-header .close:hover,
.modal .modal-header button.close:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.modal-body,
.modal-body2 {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    padding-top: 5px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    background: var(--content-bg);
}

.modal-dialog {
    margin-top: 80px;
}

/* ========================================
   Modal Responsive Overrides
   ======================================== */



/* Mobile-first responsive modal sizing */
@media (max-width: 767px) {

    /* Force modal to be full-width on mobile, override any inline styles */
    .modal-dialog,
    #myModal>.modal-dialog,
    #myModal2>.modal-dialog {
        width: calc(100% - 20px) !important;
        min-width: unset !important;
        max-width: none !important;
        margin: 10px auto !important;
    }

    /* Reduce top margin on mobile */
    .modal-dialog {
        margin-top: 20px !important;
    }

    /* Smaller header on mobile */
    .modal .modal-header {
        padding: 12px 16px !important;
        min-height: 50px;
    }

    .modal .modal-header .modal-title,
    .modal .modal-header .modal-title2,
    .modal .modal-header h4,
    .modal .modal-header h5 {
        font-size: 1.25rem !important;
    }

    .modal .modal-header .close,
    .modal .modal-header button.close {
        font-size: 2rem !important;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
    }

    /* Reduce padding on mobile */
    .modal-body,
    .modal-body2 {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
    }

    /* Panel body inside modals */
    .modal .panel-body {
        padding: 12px;
    }

    /* Buttons wrap on mobile */
    .modal .panel-body .row {
        flex-wrap: wrap;
    }

    .modal .panel-body .btn {
        margin-bottom: 8px;
    }
}

/* ========================================
   Cards & Panels  
   ======================================== */

.panel {
    background: var(--card-bg);
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-heading {
    background: var(--sidebar-bg);
    color: var(--sidebar-text-active);
    padding: 16px 20px;
    font-weight: 600;
    border: none;
}

.panel-body {
    padding: 20px;
}

/* ========================================
   Alerts & Messages
   ======================================== */

.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 14px 18px;
    font-weight: 500;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ========================================
   Tags
   ======================================== */

.tagObject {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: white;
    border: none;
    text-shadow: none;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    user-select: none;
    margin: 2px;
}

.tagObject.disabledTag {
    opacity: 0.4;
    filter: grayscale(20%);
}

.selectTag {
    cursor: pointer;
}

.selectTag:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.removeTag {
    margin-left: 8px;
    cursor: pointer;
    opacity: 0.7;
}

.removeTag:hover {
    opacity: 1;
}

/* ========================================
   Loading Spinner
   ======================================== */

.loading-container {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-message {
    color: white;
    margin-top: 16px;
    font-weight: 500;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Tooltips
   ======================================== */

.custom-tooltip {
    position: fixed;
    background: var(--sidebar-bg);
    color: white;
    padding: 10px 14px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    max-width: 300px;
    z-index: 9999;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    display: none;
}

.tooltip-container {
    position: absolute;
    display: none;
}

.tooltip-content {
    background: var(--card-bg);
    padding: 12px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

body.is-dragging .tooltip-container,
body.is-dragging .custom-tooltip,
body.is-dragging #tooltip {
    display: none !important;
}

/* ========================================
   Utility Classes
   ======================================== */

.text-muted {
    color: var(--color-text-muted);
}

.text-primary {
    color: var(--color-primary);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-primary-dark);
}

/* ========================================
   Backward Compatibility (Preserve existing)
   ======================================== */

.mainPanel {
    flex-grow: 1;
    display: flex;
}

.body-content {
    padding: 0;
    background: transparent;
    border-radius: 0;
    max-width: none;
    box-shadow: none;
    flex: 1;
}

.dl-horizontal dt {
    white-space: normal;
}

.fakeButton,
.editButton,
.addButton,
.removeButton {
    padding: 5px 5px !important;
}

.radio-custom {
    display: inline-block;
    position: relative;
    padding-left: 30px;
    margin-right: 10px;
    cursor: pointer;
}

.radio-custom input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-custom .radio-square {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    background: var(--card-bg);
    border-radius: 4px;
}

.invalido {
    background: #fee2e2;
}

.selectedDollarSign {
    color: #22c55e;
}

.selectedStar {
    color: #eab308;
}

/* Dropdown compatibility */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    min-width: max-content;
    padding: 8px 0;
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius);
    z-index: 1000;
}

.dropdown:hover .dropdown-content:not(.click-only) {
    display: block;
}

.dropdown-content li {
    list-style: none;
    padding: 0;
}

.dropdown-content li a {
    display: block;
    padding: 10px 20px;
    color: var(--color-text);
}

.dropdown-content li a:hover {
    background: var(--content-bg);
    color: var(--color-primary);
}

/* Fixed header tables - Report area */
#reportContainer .table {
    overflow: visible !important;
}

#reportContainer .table > thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

#reportContainer .table > thead th {
    background: var(--content-bg);
    box-shadow: 0 1px 0 var(--color-border);
}

.modal-message {
    padding: 15px;
    font-size: larger;
}

.modal-body2>div {
    padding: 15px;
    font-size: large;
}

/* ========================================
   Collapsible Sidebar
   ======================================== */

/* Sidebar Header - Contains brand and toggle */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header .sidebar-brand {
    flex: 1;
    border-bottom: none;
}

/* Toggle button in header */
.sidebar-collapse-btn {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    padding: 24px 16px;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 16px;
    height: -webkit-fill-available;
}

.sidebar-collapse-btn:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-bg-hover);
}

.sidebar-collapse-btn i {
    transition: transform 0.3s ease;
}

/* Collapsed State */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
}

body.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-width-collapsed);
    max-width: calc(100vw - var(--sidebar-width-collapsed));
}

body.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-collapse-btn {
    padding: 12px;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Hide text elements when collapsed */
body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-link span,
body.sidebar-collapsed .sidebar-section,
body.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .sidebar-logout span {
    display: none;
}

/* Center icons when collapsed */
body.sidebar-collapsed .sidebar-header {
    flex-direction: column;
    justify-content: center;
    padding-bottom: 4px;
}

body.sidebar-collapsed .sidebar-header .sidebar-brand {
    flex: 0;
    padding: 12px;
    width: 100%;
    justify-content: center;
}

body.sidebar-collapsed .sidebar-brand-logo {
    max-height: 20px !important;
    width: 100%;
    object-fit: contain;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 12px 10px;
}

body.sidebar-collapsed .sidebar-item {
    margin: 2px 8px;
}

body.sidebar-collapsed .sidebar-user {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-logout {
    justify-content: center;
    padding: 10px;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 16px 10px;
}

body.sidebar-collapsed .sidebar-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg);
    color: var(--sidebar-text-active);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 1002;
    box-shadow: var(--shadow-md);
}

body.sidebar-collapsed .sidebar-link:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Smooth transitions */
.sidebar {
    transition: width 0.3s ease;
}

.main-wrapper {
    transition: margin-left 0.3s ease, max-width 0.3s ease;
}

/* ========================================
   Mobile Responsive
   ======================================== */

.sidebar-toggle {
    display: none;
    background: var(--sidebar-bg);
    color: white;
    border: none;
    padding: 12px 16px;
    font-size: 20px;
    cursor: pointer;
    border-radius: 10px;
}

/* Mobile overlay backdrop (hidden by default, visible only on mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
}

@media (max-width: 991px) {

    /* Main wrapper ALWAYS stays at collapsed offset on mobile */
    .main-wrapper {
        margin-left: var(--sidebar-width-collapsed) !important;
        max-width: calc(100vw - var(--sidebar-width-collapsed)) !important;
    }

    /* Mobile: Sidebar transitions between collapsed and expanded overlay */
    .sidebar {
        transition: width 0.3s ease;
    }

    /* === COLLAPSED STATE (default on mobile) === */
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-width-collapsed);
        box-shadow: none;
    }

    /* Hide text elements when collapsed */
    body.sidebar-collapsed .sidebar-brand-text,
    body.sidebar-collapsed .sidebar-link span,
    body.sidebar-collapsed .sidebar-section,
    body.sidebar-collapsed .sidebar-user-info,
    body.sidebar-collapsed .sidebar-logout span {
        display: none;
    }

    body.sidebar-collapsed .sidebar-header {
        flex-direction: column;
        justify-content: center;
        padding-bottom: 4px;
    }

    body.sidebar-collapsed .sidebar-header .sidebar-brand {
        flex: 0;
        padding: 12px;
        width: 100%;
        justify-content: center;
    }

    body.sidebar-collapsed .sidebar-brand-logo {
        max-height: 20px !important;
        width: 100%;
        object-fit: contain;
    }

    body.sidebar-collapsed .sidebar-collapse-btn {
        padding: 12px;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    body.sidebar-collapsed .sidebar-collapse-btn i {
        transform: rotate(180deg);
    }

    body.sidebar-collapsed .sidebar-link {
        justify-content: center;
        padding: 12px 10px;
    }

    body.sidebar-collapsed .sidebar-item {
        margin: 2px 8px;
    }

    body.sidebar-collapsed .sidebar-user {
        justify-content: center;
    }

    body.sidebar-collapsed .sidebar-logout {
        justify-content: center;
        padding: 10px;
    }

    body.sidebar-collapsed .sidebar-footer {
        padding: 16px 10px;
    }

    /* Tooltips on collapsed icons */
    body.sidebar-collapsed .sidebar-link::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--sidebar-bg);
        color: var(--sidebar-text-active);
        padding: 8px 12px;
        border-radius: var(--border-radius);
        font-size: 14px;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all 0.2s ease;
        pointer-events: none;
        z-index: 1002;
        box-shadow: var(--shadow-md);
    }

    body.sidebar-collapsed .sidebar-link:hover::after {
        opacity: 1;
        visibility: visible;
    }

    /* === EXPANDED STATE (overlay on mobile) === */
    .sidebar {
        width: var(--sidebar-width);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }

    /* Toggle button always visible on mobile */
    .sidebar-collapse-btn {
        display: flex !important;
    }

    /* Hide hamburger toggle (not needed, we use collapse btn) */
    .sidebar-toggle {
        display: none !important;
    }
}

/* ========================================
   Full-Height Table Layouts (Flexbox)
   ======================================== */

/* Full-height content card for list pages */
.content-card.full-height {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    margin-bottom: 0;
}

/* DataTable flex container */
.datatable-flex-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: 10px;
}

.datatable-flex-container .dataTables_wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.datatable-flex-container .dataTables_scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.datatable-flex-container .dataTables_scrollHead {
    flex-shrink: 0;
}

.datatable-flex-container .dataTables_scrollBody {
    flex: 1 !important;
    max-height: none !important;
    min-height: 0;
    overflow: auto !important;
}

/* Main content flex adjustments for full-height pages */
.main-content.full-height {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

@media (max-width: 767px) {
    .main-header {
        padding: 12px 16px;
    }

    .main-header h1 {
        font-size: 18px;
    }

    .main-content {
        padding: 16px;
    }
}

/* ========================================
   Modals
   ======================================== */
/* ========================================
   Modals
   ======================================== */
.modal-body,
.modal-body2 {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

/* ========================================
   DataTables Responsive Fixes
   ======================================== */
.dataTables_scrollHeadInner {
    min-width: 100% !important;
}

.dataTables_scrollHeadInner table.dataTable,
.dataTables_scrollBody table.dataTable {
    min-width: 100% !important;
}

.userListFuncHeader {
    padding-bottom: 12px;
}

/* ========================================
   Modal Resize Handles
   ======================================== */

/* Resize handles are placed on .modal-dialog (not modal-content) to avoid overflow:hidden clipping */
.modal-dialog {
    position: relative;
}

.modal-resize-handle {
    position: absolute;
    z-index: 1060;
}

.modal-resize-handle-e,
.modal-resize-handle-w {
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
}

.modal-resize-handle-e {
    right: 0;
}

.modal-resize-handle-w {
    left: 0;
}

.modal-resize-handle-s {
    left: 0;
    right: 0;
    bottom: 0;
    height: 8px;
    cursor: ns-resize;
}

.modal-resize-handle-se {
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}

/* Disable text selection during drag */
body.modal-resizing,
body.modal-resizing * {
    user-select: none !important;
    -webkit-user-select: none !important;
}