/* =========================================================================
   USORDER.VN - ADMIN CONTROL PANEL STYLESHEET (MODERN DARK THEME)
   ========================================================================= */

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

/* Base Reset & Variables */
:root {
    --bg-main: #0b1120;
    --bg-card: rgba(15, 23, 42, 0.85);
    --bg-input: #020617;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(56, 189, 248, 0.4);
    --accent-blue: #38bdf8;
    --accent-green: #22c55e;
    --accent-purple: #a855f7;
    --accent-amber: #facc15;
    --accent-red: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    padding: 24px 20px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #0f172a;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 999px;
}

/* Topbar Header Navigation */
.topbar {
    max-width: 1400px;
    margin: 0 auto 24px auto;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.35);
    color: var(--accent-blue);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.user-chip strong {
    color: var(--text-main);
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #ef4444;
    color: #ffffff;
}

/* Stats Summary Row */
.stats-row {
    max-width: 1400px;
    margin: 0 auto 24px auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.stat-box-info h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-box-info .num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
}

.stat-box-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-box.blue .stat-box-icon { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); }
.stat-box.green .stat-box-icon { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.stat-box.purple .stat-box-icon { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }

/* Main Grid Layout */
.layout {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

/* Cards & Panels */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    margin-bottom: 24px;
}

.card h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

/* Forms & Inputs */
label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #cbd5e1;
    margin-top: 14px;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
    background: #020617;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.row {
    display: flex;
    gap: 12px;
}

.row > div {
    flex: 1;
}

.checkbox-row {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-row label {
    margin: 0;
    text-transform: none;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.muted {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.muted code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-blue);
}

/* Buttons */
button, .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 18px;
    padding: 11px 18px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #0284c7, #22c55e);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}

button:hover, .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-size: 0.82rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

/* Action Icons */
a.action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--accent-blue);
    text-decoration: none;
    margin-right: 4px;
    transition: all 0.15s;
}

a.action:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

a.action.del {
    color: #f87171;
}

a.action.del:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

thead {
    background: rgba(2, 6, 23, 0.95);
}

th {
    padding: 12px 14px;
    color: #cbd5e1;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.td-prod-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.prod-name-title {
    font-weight: 600;
    color: #f1f5f9;
    text-decoration: none;
    transition: color 0.15s;
    display: block;
}

.prod-name-title:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.price {
    font-weight: 700;
    color: var(--accent-blue);
    font-size: 0.95rem;
    white-space: nowrap;
}

/* Badges & Tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.tag-int { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.3); }
.tag-mic { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.3); }
.tag-inst { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.3); }
.tag-other { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #334155;
    transition: 0.25s;
    border-radius: 999px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.25s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* Alerts */
.alert {
    max-width: 1400px;
    margin: 0 auto 16px auto;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-ok {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
}

.alert-del {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.alert-warn {
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: #fde047;
}

/* Confirm Boxes */
.confirm-box {
    max-width: 1400px;
    margin: 0 auto 20px auto;
    border-radius: 14px;
    padding: 16px 20px;
    border: 1px solid rgba(239, 68, 68, 0.5);
    background: rgba(127, 29, 29, 0.35);
    font-size: 0.9rem;
}

.confirm-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fca5a5;
    margin-bottom: 6px;
}

.confirm-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Login Page Styling */
body.login-page {
    background: radial-gradient(circle at top, #1e293b, #0b1120);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 20px;
    padding: 36px 30px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.login-logo .icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0284c7, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
}

.login-card h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-card .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.login-error {
    margin-top: 12px;
    font-size: 0.82rem;
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.login-back-link {
    margin-top: 20px;
    font-size: 0.82rem;
    text-align: center;
}

.login-back-link a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.login-back-link a:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* Admin Footer */
.admin-footer {
    max-width: 1400px;
    margin: 40px auto 0 auto;
    padding: 20px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.85rem;
}

.admin-menu {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.admin-menu a {
    text-decoration: none;
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 0.85rem;
    transition: color 0.15s;
}

.admin-menu a:hover {
    color: var(--accent-green);
    text-decoration: underline;
}

/* Info Form & Section Styling */
.info-container {
    max-width: 980px;
    margin: 0 auto;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 8px;
    margin-top: 24px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-divider i {
    font-size: 1.1rem;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

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

.form-help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.api-warning-box {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.82rem;
    color: #fde68a;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.api-warning-box i {
    font-size: 1.2rem;
    color: var(--accent-amber);
    margin-top: 2px;
}

/* Bulk Selection Toolbar & Rows */
.bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 10px 16px;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.bulk-bar .selected-info {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.bulk-bar .selected-info strong {
    color: var(--accent-blue);
    font-size: 0.95rem;
}

input[type="checkbox"].item-checkbox, #checkAll {
    width: 17px;
    height: 17px;
    accent-color: var(--accent-blue);
    cursor: pointer;
    vertical-align: middle;
}

tr.selected-row {
    background-color: rgba(56, 189, 248, 0.08) !important;
}