:root {
    /* Màu sáng, tươi sáng */
    --primary: #5b21b6;
    --primary-dark: #7c3aed;
    --primary-light: #a78bfa;
    --secondary: #0891b2;
    --secondary-light: #06b6d4;
    --accent: #ec4899;
    
    --background: #f8fafc;
    --surface: #ffffff;
    --card: #ffffff;
    
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
    --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.15);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--background);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e0f2fe 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(91, 33, 182, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    top: -150px;
    right: -150px;
    animation: float 8s ease-in-out infinite;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(8, 145, 178, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    bottom: -100px;
    left: -100px;
    animation: float 10s ease-in-out infinite reverse;
}

.login-card {
    width: 100%;
    max-width: 450px;
    padding: 3rem 2.5rem;
    position: relative;
    z-index: 10;
    animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: var(--surface);
    border-radius: 32px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #5b21b6 0%, #0891b2 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 2.2rem;
    color: white;
    box-shadow: 0 20px 40px rgba(91, 33, 182, 0.25);
}

.login-card h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #5b21b6, #0891b2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 1.5rem;
}

.login-card p {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.login-card .input-group-text {
    color: var(--text-muted);
    border: 2px solid var(--border-light) !important;
    background: transparent;
}

.login-card .form-control {
    background-color: #f8fafc;
    border: 2px solid var(--border-light);
    color: var(--text);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: var(--transition);
}

.login-card .form-control:focus {
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.1);
    color: var(--text);
}

.login-card .form-control::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 100%);
    border: none;
    border-radius: 12px;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: 0 10px 25px rgba(91, 33, 182, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(91, 33, 182, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ===== MAIN LAYOUT ===== */
.main-dashboard {
    display: flex;
    min-height: 100vh;
    background: var(--background);
}

.main-content,
.pages-container,
.page,
.card-body,
.card-header-custom,
.stat-card,
.sidebar-footer,
.modal-content,
.toast-notification,
.drag-drop-zone,
.form-control,
.form-select,
.form-check-input,
.table,
.table-responsive {
    background: var(--surface) !important;
}

.top-header {
    background: var(--surface);
    border-color: var(--border);
}

.sidebar,
.login-card {
    background: var(--surface);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(91, 33, 182, 0.1), rgba(8, 145, 178, 0.1)) !important;
    color: var(--primary) !important;
    border-left: 4px solid var(--primary);
}

.card-header-custom,
.stat-card,
.sidebar-footer,
.page {
    border: 1px solid var(--border);
}

.table thead {
    background: #f8fbff;
}

.table tbody tr {
    border-color: var(--border);
}

.table tbody tr:hover {
    background: #f9fafb;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    height: 100vh;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border-right: 2px solid var(--border-light);
    box-shadow: 4px 0 15px rgba(15, 23, 42, 0.08);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
}

.sidebar-header h5 {
    margin: 0;
    font-weight: 800;
    color: var(--text);
    font-size: 1.2rem;
    background: linear-gradient(135deg, #5b21b6, #0891b2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header .logo-icon {
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 10px 25px rgba(91, 33, 182, 0.2);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition);
    cursor: pointer;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(91, 33, 182, 0.08);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(91, 33, 182, 0.15), rgba(8, 145, 178, 0.1));
    color: var(--primary);
    border-left: 4px solid var(--primary);
    padding-left: calc(1.2rem - 4px);
    box-shadow: 0 4px 12px rgba(91, 33, 182, 0.15);
}

.nav-item i {
    font-size: 1.3rem;
    min-width: 1.3rem;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-light);
}

.btn-outline-danger {
    color: var(--danger);
    border-color: var(--danger);
    font-weight: 600;
}

.btn-outline-danger:hover {
    background-color: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    width: calc(100% - 280px);
    min-height: 100vh;
    overflow-y: auto;
    background: var(--background);
}

.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border-light);
    margin: 1rem;
    margin-bottom: 0;
    border-radius: 24px 24px 0 0;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-left h2 {
    font-weight: 800;
    font-size: 1.75rem;
    background: linear-gradient(135deg, #5b21b6, #0891b2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.server-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.3rem;
    background: linear-gradient(135deg, rgba(91, 33, 182, 0.1), rgba(8, 145, 178, 0.1));
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 600;
    border: 2px solid rgba(91, 33, 182, 0.15);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--text);
}

.user-info i {
    font-size: 1.8rem;
    color: var(--primary);
}

/* ===== PAGES CONTAINER ===== */
.pages-container {
    flex: 1;
    padding: 0 1rem 1rem 1rem;
    overflow-y: auto;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== STAT CARDS ===== */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    height: 100%;
    transition: var(--transition);
    border: 2px solid var(--border-light);
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(91, 33, 182, 0.05) 0%, transparent 70%);
    border-radius: 50%;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
    border-color: rgba(91, 33, 182, 0.3);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.stat-icon.bg-primary {
    background: linear-gradient(135deg, #5b21b6, #7c3aed);
}

.stat-icon.bg-success {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.stat-icon.bg-danger {
    background: linear-gradient(135deg, #ef4444, #f87171);
}

.stat-icon.bg-info {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
}

.stat-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}

/* ===== CARD HEADERS ===== */
.card-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.8rem;
    border-bottom: 2px solid var(--border-light);
    gap: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 20px 20px 0 0;
}

.card-header-custom h5 {
    margin: 0;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.2rem;
    color: var(--text);
}

.card-header-custom h5 i {
    font-size: 1.5rem;
    color: var(--primary);
}

/* ===== TABLES ===== */
.table {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface);
    margin: 0;
}

.table thead {
    background: linear-gradient(135deg, #f8fbff 0%, #f0f4f8 100%);
}

.table thead th {
    color: var(--text);
    font-weight: 700;
    border-color: var(--border-light);
    font-size: 0.95rem;
    padding: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table tbody tr {
    border-color: var(--border-light);
    transition: var(--transition);
}

.table tbody tr:hover {
    background: linear-gradient(90deg, rgba(91, 33, 182, 0.03), rgba(8, 145, 178, 0.03));
}

.table tbody td {
    vertical-align: middle;
    color: var(--text);
    padding: 1.2rem;
}

/* ===== BADGES ===== */
.badge-online {
    background: linear-gradient(135deg, #10b981, #34d399);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.badge-offline {
    background: linear-gradient(135deg, #ef4444, #f87171);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.pulse-online {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.online-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* ===== FORMS ===== */
.form-label {
    color: var(--text);
    font-weight: 700;
    margin-bottom: 0.7rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    background-color: #f8fafc;
    border: 2px solid var(--border-light);
    color: var(--text);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    font-weight: 500;
    transition: var(--transition);
}

.form-control:focus {
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(91, 33, 182, 0.1);
    color: var(--text);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-check-label {
    color: var(--text);
    font-weight: 600;
}

.form-check-input {
    background-color: var(--border-light);
    border: 2px solid var(--border);
}

.form-check-input:checked {
    background: linear-gradient(135deg, #5b21b6, #7c3aed);
    border-color: transparent;
}

/* ===== DRAG DROP ZONE ===== */
.drag-drop-zone {
    border: 3px dashed var(--border);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: linear-gradient(135deg, rgba(91, 33, 182, 0.03), rgba(8, 145, 178, 0.03));
    position: relative;
    overflow: hidden;
}

.drag-drop-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(91, 33, 182, 0.05) 0%, transparent 70%);
    opacity: 0;
    transition: var(--transition);
}

.drag-drop-zone:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(91, 33, 182, 0.08), rgba(8, 145, 178, 0.08));
}

.drag-drop-zone.dragover {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(52, 211, 153, 0.1));
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.2);
}

.drag-drop-zone i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: block;
}

.file-input {
    display: none;
}

/* ===== PROGRESS BAR ===== */
.progress {
    background-color: var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    height: 10px;
}

.progress-bar {
    background: linear-gradient(90deg, #5b21b6, #0891b2);
    box-shadow: 0 0 15px rgba(91, 33, 182, 0.4);
}

/* ===== SYSTEM STATUS ===== */
.system-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 2rem;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(91, 33, 182, 0.08), rgba(8, 145, 178, 0.08));
    border: 2px solid var(--border-light);
    transition: var(--transition);
}

.status-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-sm);
}

.status-item span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-item strong {
    font-size: 1.8rem;
    color: var(--primary);
    font-weight: 800;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
}

.toast-notification {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.2rem 1.5rem;
    background: var(--surface);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    color: var(--text);
    margin-bottom: 1rem;
    animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow);
    font-weight: 600;
}

.toast-notification.success {
    border-left: 5px solid var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(52, 211, 153, 0.05));
}

.toast-notification.danger {
    border-left: 5px solid var(--danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(248, 113, 113, 0.05));
}

.toast-notification.warning {
    border-left: 5px solid var(--warning);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(250, 204, 21, 0.05));
}

.toast-notification.info {
    border-left: 5px solid var(--info);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05), rgba(34, 211, 238, 0.05));
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* ===== MODALS ===== */
.modal-content {
    background: var(--surface);
    border: 2px solid var(--border-light);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-color: var(--border-light);
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 20px 20px 0 0;
    padding: 1.8rem;
}

.modal-footer {
    border-color: var(--border-light);
}

.modal-title {
    color: var(--text);
    font-weight: 800;
    font-size: 1.25rem;
}

/* ===== BUTTONS ===== */
.btn-secondary {
    background-color: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
    transition: var(--transition);
    font-weight: 600;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(91, 33, 182, 0.1), rgba(8, 145, 178, 0.1));
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary {
    border-color: var(--border);
    color: var(--text-secondary);
    font-weight: 600;
}

.btn-outline-primary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: linear-gradient(135deg, rgba(91, 33, 182, 0.1), rgba(8, 145, 178, 0.1));
}

.btn-info {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
    border-color: transparent;
    font-weight: 600;
}

.btn-info:hover {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    box-shadow: 0 10px 25px rgba(8, 145, 178, 0.3);
}

.btn-sm {
    font-weight: 600;
    border-radius: 8px;
    padding: 0.5rem 1rem;
}

/* ===== SPINNER ===== */
.spinner-border {
    color: var(--primary);
    width: 3rem;
    height: 3rem;
    border-width: 3px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
        z-index: 1001;
        box-shadow: 10px 0 20px rgba(0, 0, 0, 0.15);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .top-header {
        margin: 1rem 0.5rem 0 0.5rem;
    }

    .pages-container {
        padding: 0 0.5rem 1rem 0.5rem;
    }

    .server-time {
        display: none;
    }

    .stat-card {
        padding: 1.5rem;
    }

    .stat-value {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .header-right {
        gap: 1rem;
    }

    .system-status {
        grid-template-columns: 1fr;
    }

    .user-info span {
        display: none;
    }

    #pageTitle {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .login-card {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .login-container::before,
    .login-container::after {
        display: none;
    }

    .drag-drop-zone {
        padding: 2rem 1rem;
    }

    .drag-drop-zone i {
        font-size: 2.5rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }

    .card-header-custom {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header-custom input {
        width: 100% !important;
    }

    .table {
        font-size: 0.8rem;
    }

    .toast-container {
        left: 0.5rem;
        right: 0.5rem;
        top: 0.5rem;
    }

    .toast-notification {
        padding: 1rem;
        gap: 0.8rem;
    }
}