:root {
    /* Colors */
    --color-bg: #020617;
    --color-surface: #0f172a;
    --color-surface-hover: #1e293b;
    --color-primary: #3b82f6;
    --color-secondary: #e11d48;
    /* Alarm Red */
    --color-accent: #06b6d4;
    --color-text-main: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-border: #1e293b;
    --color-success: #22c55e;
    --color-warning: #eab308;
    --color-danger: #ef4444;

    /* Typography */
    --font-main: 'Inter', sans-serif;

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.5);
    --shadow-glow-red: 0 0 15px rgba(225, 29, 72, 0.5);

    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-main);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow: hidden;
    /* App-like feel */
    height: 100vh;
    display: flex;
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-danger {
    color: var(--color-danger);
}

.text-warning {
    color: var(--color-warning);
}

.text-success {
    color: var(--color-success);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.9rem;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-secondary), #ef4444);
    color: white;
    box-shadow: 0 2px 10px rgba(225, 29, 72, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(225, 29, 72, 0.5);
}

.btn-warning {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: white;
    box-shadow: 0 2px 10px rgba(251, 191, 36, 0.3);
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.5);
}


.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-text-muted);
}

.btn-icon:hover {
    background: var(--color-surface-hover);
    color: white;
}

/* Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.logo-area {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 1.25rem;
    font-weight: 800;
}

.logo-area i {
    margin-right: 0.5rem;
    color: var(--color-text-main);
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item i {
    width: 24px;
    margin-right: 0.75rem;
    text-align: center;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    font-weight: 600;
}

.nav-item.danger-zone {
    margin-top: auto;
    color: var(--color-danger);
}

.nav-item.danger-zone:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(225, 29, 72, 0.05) 0%, transparent 40%);
}

.top-bar {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--color-border);
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(8px);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-success);
    border-radius: var(--radius-full);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    box-shadow: 0 0 5px currentColor;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Modules */
.module {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.module.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(5px);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Inputs */
input,
select {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--color-primary);
}

/* Modern Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 2rem;
    gap: 2rem;
}

.tab-link {
    padding: 1rem 0;
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-link:hover {
    color: var(--color-text-main);
}

.tab-link.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    vertical-align: middle;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-surface-hover);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--color-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--color-success);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* Badge */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-surface-hover);
    color: var(--color-text-main);
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        top: auto;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--color-border);
        padding: 0.5rem;
        justify-content: space-around;
        order: 2;
    }

    .logo-area {
        display: none;
    }

    .nav-menu {
        flex-direction: row;
        padding: 0;
        width: 100%;
        justify-content: space-around;
    }

    .nav-item {
        flex-direction: column;
        padding: 0.5rem;
        font-size: 0.7rem;
        gap: 0.25rem;
    }

    .nav-item i {
        margin: 0;
        font-size: 1.25rem;
    }

    .nav-text {
        display: none;
    }

    .main-content {
        order: 1;
        height: calc(100vh - 70px);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    color: var(--color-text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
    font-weight: 500;
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-danger);
}

.toast.info {
    border-left: 4px solid var(--color-primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Custom Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease-out;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text-main);
}

.modal-message {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}