/* ==========================================================================
   THEND PANEL CORE STYLES - UNIFIED DESIGN SYSTEM (2025 Refactor)
   ========================================================================== */

:root {
    /* ------------------- Color Palette (Premium Dark) ------------------- */
    --primary: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --primary-glow: rgba(99, 102, 241, 0.4);

    --secondary: #8b5cf6;
    /* Violet 500 */

    --success: #10b981;
    /* Emerald 500 */
    --danger: #ef4444;
    /* Red 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --info: #3b82f6;
    /* Blue 500 */

    /* Base Backgrounds */
    --bg-dark: #0f172a;
    /* Slate 900 */
    --bg-card: rgba(30, 41, 59, 0.7);
    /* Slate 800 (Glass) */
    --bg-input: rgba(15, 23, 42, 0.8);

    /* Typography Colors */
    --text-main: #f8fafc;
    /* Slate 50 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --text-label: #cbd5e1;
    /* Slate 300 */

    /* Borders & Effects */
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-blur: 16px;
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);

    /* Dimensions & Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

/* ------------------- Reset & Base Typography ------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 25%);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

h2.page-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* ------------------- Layout Grid ------------------- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(var(--glass-blur));
    border-right: var(--glass-border);
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    left: 0;
    top: 0;
}

.sidebar-header {
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateX(4px);
}

.sidebar-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.sidebar-link .icon {
    width: 24px;
    display: flex;
    justify-content: center;
    font-size: 1.1rem;
    opacity: 0.8;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--danger);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
    opacity: 0.8;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1);
    opacity: 1;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    max-width: 1600px;
    width: calc(100% - var(--sidebar-width));
}

/* Dashboard Cards */
.dash-card {
    background: var(--bg-card);
    border: var(--glass-border);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.dash-card:hover {
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.85);
}

.dash-card-title {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.dash-card-value {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.dash-card-icon {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2.5rem;
    opacity: 0.1;
}

/* Responsive Grid Helpers */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem;
    }
}

/* ------------------- Key Component: Glass Panel ------------------- */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* ------------------- Forms & Inputs ------------------- */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-label);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: #fff;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ------------------- Buttons ------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ------------------- Modern Tables ------------------- */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.modern-table th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-label);
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modern-table td {
    padding: 1rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modern-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: #fff;
}

/* ------------------- Status Badges ------------------- */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

/* ------------------- Alerts ------------------- */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    background: rgba(0, 0, 0, 0.2);
}

.alert-success {
    border-color: var(--success);
    color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.alert-error {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

/* ------------------- Animations ------------------- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}