:root {
    --primary: #1877f2;
    --primary-hover: #166fe5;
    --dark-bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.5;
    background-image: radial-gradient(circle at top right, rgba(24, 119, 242, 0.15), transparent),
        radial-gradient(circle at bottom left, rgba(138, 43, 226, 0.1), transparent);
    min-height: 100vh;
    font-size: 14.5px;
}

h1,
h2,
h3 {
    color: #fff;
    margin-bottom: 1rem;
    font-weight: 700;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.15rem;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
}

/* Sidebar */
.sidebar {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    height: fit-content;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    font-size: 0.925rem;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 0.875rem;
}

/* Bố cục cột cho bảng Licenses */
.table-licenses th:nth-child(1),
.table-licenses td:nth-child(1) {
    width: 40%;
}

/* Thông tin License (Sản phẩm + Key) */
.table-licenses th:nth-child(2),
.table-licenses td:nth-child(2) {
    width: 15%;
    text-align: center;
}

/* Trạng thái */
.table-licenses th:nth-child(3),
.table-licenses td:nth-child(3) {
    width: 15%;
    text-align: center;
}

/* Kích hoạt */
.table-licenses th:nth-child(4),
.table-licenses td:nth-child(4) {
    width: 20%;
    text-align: center;
}

/* Hết hạn */
.table-licenses th:nth-child(5),
.table-licenses td:nth-child(5) {
    width: 10%;
    text-align: center;
}

/* Thao tác */

/* Bố cục cột cho bảng Activations */
.table-activations th:nth-child(1),
.table-activations td:nth-child(1) {
    width: 40%;
}

/* License (Sản phẩm + Key) */
.table-activations th:nth-child(2),
.table-activations td:nth-child(2) {
    width: 20%;
}

/* Tên miền */
.table-activations th:nth-child(3),
.table-activations td:nth-child(3) {
    width: 15%;
    text-align: center;
}

/* IP Address */
.table-activations th:nth-child(4),
.table-activations td:nth-child(4) {
    width: 15%;
    text-align: center;
}

/* Thời gian */
.table-activations th:nth-child(5),
.table-activations td:nth-child(5) {
    width: 10%;
    text-align: center;
}

/* Thao tác */

/* Bố cục cột cho bảng Products */
.table-products th:nth-child(1),
.table-products td:nth-child(1) {
    width: 45%;
}

/* Sản phẩm (Tên + Slug) */
.table-products th:nth-child(2),
.table-products td:nth-child(2) {
    width: 15%;
    text-align: center;
}

/* Số lượng */
.table-products th:nth-child(3),
.table-products td:nth-child(3) {
    width: 15%;
    text-align: center;
}

/* Miễn phí */
.table-products th:nth-child(4),
.table-products td:nth-child(4) {
    width: 15%;
    text-align: center;
}

/* Ngày tạo */
.table-products th:nth-child(5),
.table-products td:nth-child(5) {
    width: 10%;
    text-align: center;
}

/* Thao tác */

/* Bố cục cột cho bảng Versions */
.table-versions th:nth-child(1),
.table-versions td:nth-child(1) {
    width: 25%;
}

/* Sản phẩm */
.table-versions th:nth-child(2),
.table-versions td:nth-child(2) {
    width: 15%;
    text-align: center;
}

/* Phiên bản */
.table-versions th:nth-child(3),
.table-versions td:nth-child(3) {
    width: 25%;
    text-align: center;
}

/* Ngày phát hành */
.table-versions th:nth-child(4),
.table-versions td:nth-child(4) {
    width: 25%;
    text-align: center;
}

/* Ngày sửa đổi */
.table-versions th:nth-child(5),
.table-versions td:nth-child(5) {
    width: 10%;
    text-align: center;
}

/* Thao tác */

tr:last-child td {
    border-bottom: none;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
    text-decoration: none;
    font-size: 0.875rem;
}

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

.btn-sm {
    padding: 4px 12px;
}

.badge {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Forms */
input,
select,
textarea {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    width: 100%;
    margin-bottom: 1rem;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Admin Header and Hamburger */
.admin-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-header {
        margin-bottom: 1rem;
        padding: 0.5rem 0;
        gap: 8px;
    }

    #menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .admin-header h1 {
        font-size: 0.95rem !important;
        line-height: 1.1 !important;
        white-space: nowrap;
    }

    .admin-header h1 i {
        font-size: 0.8rem;
    }

    .admin-name {
        display: none;
    }

    .admin-header div:last-child {
        gap: 8px !important;
    }

    .admin-header .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .admin-header a[href="profile.php"] {
        font-size: 0.8rem;
    }

    .container {
        padding: 0.5rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 100%;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
        margin: 0;
        border-radius: 0;
        padding: 2rem 1rem;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .nav-item {
        display: flex;
        padding: 12px 16px;
        margin-bottom: 8px;
        font-size: 0.95rem;
    }

    main {
        padding: 0;
        width: 100%;
        overflow: hidden;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
        width: 100%;
    }

    .card-title {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .btn:not(.btn-sm) {
        width: 100%;
        justify-content: center;
        margin-bottom: 5px;
    }

    .card-title .btn {
        width: auto !important;
        margin: 0;
        padding: 4px 12px;
        font-size: 0.75rem;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        padding: 0 2px;
    }

    table {
        min-width: 100%;
    }

    th,
    td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }

    .hide-mobile {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .admin-header h1 {
        font-size: 1rem !important;
    }
}