/* Variables */
:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 0;
    --header-height: 60px;
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
}

/* General */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Loading Overlay */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9999;
}

body.loading {
    overflow: hidden;
}

.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -20px;
    margin-left: -20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Layout */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--dark-color);
    color: #fff;
    transition: all 0.3s;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
}

/* Sidebar submenu styles */
#sidebar ul ul {
    background-color: rgba(0, 0, 0, 0.1);
    margin: 0;
    padding: 0;
}

#sidebar ul ul li a {
    padding-left: 30px !important;
    font-size: 0.9em;
}

#sidebar ul ul li a:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

#sidebar .nav-link[data-bs-toggle="collapse"] i.fa-chevron-down {
    transition: transform 0.3s;
}

#sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="true"] i.fa-chevron-down {
    transform: rotate(180deg);
}

#sidebar .nav-link .badge {
    font-size: 0.75em;
    padding: 0.25em 0.6em;
    font-weight: 600;
    margin-top: 2px;
    min-width: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Settings warning badge */
#sidebar .nav-link .badge.bg-warning {
    font-size: 0.7em;
    padding: 0.3em 0.6em;
    font-weight: normal;
    margin-left: 5px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#sidebar .nav-link .badge.bg-warning i {
    font-size: 0.9em;
    margin-right: 3px;
}

#sidebar .nav-link:hover .badge.bg-warning {
    background-color: #ffc107 !important;
    box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
}

.sidebar-toggle-desktop {
    display: none;
}

#sidebar.active {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebar .nav {
    padding: 1rem 0;
}

#sidebar .nav-link {
    padding: 0.8rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
    transition: all 0.3s;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
}

#sidebar .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
}

/* Content */
#content {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

#content.active {
    width: 100%;
    margin-left: 0;
}

/* Navbar */
.navbar {
    height: var(--header-height);
    background: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
}

.navbar .btn {
    padding: 0.375rem 0.75rem;
}

.navbar .dropdown-menu {
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
    border: none;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,.05);
    margin-bottom: 1rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 1rem;
}

/* Tables */
.table-container {
    background: #fff;
    border-radius: 10px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table th {
    background: #f8f9fa;
    border-top: none;
    font-weight: 600;
}

.table td {
    vertical-align: middle;
}

/* Pagination */
.pagination {
    margin: 1rem 0 0;
    justify-content: center;
}

.page-link {
    border: none;
    padding: 0.5rem 0.75rem;
    margin: 0 0.25rem;
    border-radius: 5px;
    color: var(--primary-color);
}

.page-link:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Forms */
.form-control {
    border-radius: 5px;
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Buttons */
.btn {
    border-radius: 5px;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}


@media (max-width: 1200px) {
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    #sidebar.active {
        margin-left: 0;
        position: fixed;
    }

    .sidebar-toggle-desktop {
        display: block;
    }

    #content {
        width: 100%;
        margin-left: 0;
    }

    #content.active {
        overflow: hidden;
    }

    .navbar .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
}

/* Utilities */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

._c_contact-box {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
    font-family: 'Arial', sans-serif;
}

._c_contact-toggle {
    background: linear-gradient(135deg, #007bff, #00d4ff);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    border: none;
}

._c_contact-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

._c_contact-toggle.active {
    background: linear-gradient(135deg, #dc3545, #ff6b6b);
    padding: 0.75rem;
}

._c_contact-icon {
    width: 1.5rem;
    height: 1.5rem;
    background: url('/icons/support-icon.png') no-repeat center;
    background-size: contain;
    filter: brightness(0) invert(1);
    margin-right: 0.5rem;
    transition: background 0.2s ease;
}

._c_contact-toggle.active ._c_contact-icon {
    background: url('/icons/x-icon.png') no-repeat center;
    background-size: contain;
    margin-right: 0;
}

._c_contact-text {
    font-size: 1rem;
    font-weight: bold;
    transition: opacity 0.2s ease;
}

._c_contact-content {
    display: none;
    background: white;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-top: 0.75rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    max-width: 20rem;
    animation: slideUp 0.3s ease-out;
}

._c_contact-content.active {
    display: block;
}

._c_method-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background 0.2s ease;
}

._c_method-item:hover {
    background: #f8f9fa;
}

._c_method-icon {
    width: 2rem;
    height: 2rem;
    margin-right: 0.75rem;
    background: url('/icons/zalo-icon.webp') no-repeat center;
    background-size: contain;
}

._c_method-label {
    font-size: 0.875rem;
    color: #333;
    font-weight: 500;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    ._c_contact-box {
        bottom: 1rem;
        right: 1rem;
    }

    ._c_contact-toggle {
        padding: 0.625rem 1rem;
    }

    ._c_contact-text {
        font-size: 0.875rem;
    }

    ._c_contact-content {
        padding: 1rem;
        max-width: 18rem;
    }

    ._c_method-icon {
        width: 1.5rem;
        height: 1.5rem;
    }

    ._c_method-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    ._c_contact-toggle {
        padding: 0.5rem 0.75rem;
        border-radius: 40px;
    }

    ._c_contact-icon {
        width: 1.25rem;
        height: 1.25rem;
    }

    ._c_contact-content {
        max-width: 15rem;
    }
}

#overlay-global {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

._c_popup_overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

._c_popup_container {
    background: #1c2526;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: _c_popup_animate 0.3s ease-out;
    color: #e7e9ea;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes _c_popup_animate {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

._c_popup_title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #ffffff;
}

._c_popup_message {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 20px;
    color: #d1d4d6;
}

._c_popup_button {
    background: #1d9bf0;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    max-width: 200px;
}

._c_popup_button:hover {
    background: #1a8cd8;
}

@media (max-width: 480px) {
    ._c_popup_container {
        padding: 16px;
        width: 95%;
    }

    ._c_popup_title {
        font-size: 18px;
    }

    ._c_popup_message {
        font-size: 14px;
    }

    ._c_popup_button {
        padding: 8px 20px;
        font-size: 14px;
    }
}
