:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass: rgba(255, 255, 255, 0.7);
    --border: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html, body {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.5;
}

/* Hard Block for Horizontal Scroll */
.no-overflow {
    max-width: 100vw;
    width: 100%;
    overflow-x: hidden !important;
    overflow-y: auto;
    position: relative;
    display: block;
}

/* Common Layout Components */
.card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow: hidden;
    max-width: 100%;
}

@media (max-width: 600px) {
    .card { padding: 1.25rem; border-radius: var(--radius-md); }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(239, 68, 68, 0.2); }

/* Table Styling - Optimized for Mobile */
.table-container {
    width: 100%;
    overflow-x: auto !important;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #fff;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    max-width: 100%;
}

table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

table th {
    background: #f1f5f9;
    padding: 1rem 0.85rem;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 800;
}

table td {
    padding: 1rem 0.85rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    word-break: break-word;
}

/* Dashboard Sidebar - Ultra Stable */
.sidebar {
    width: 280px;
    height: 100vh;
    background: #fff;
    position: fixed;
    top: 0;
    left: 0;
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    z-index: 1000;
    transition: all 0.1s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    font-size: 24px;
    font-weight: 900;
    color: var(--primary);
    text-align: center;
    margin-bottom: 2.5rem;
    letter-spacing: -1.5px;
}

.sidebar h2 span { color: #000; }

.sidebar nav {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.35rem;
    transition: 0.1s;
    font-weight: 700;
    gap: 12px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link i {
    min-width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-link:hover { background: #f8fafc; color: var(--primary); }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 8px 15px rgba(99, 102, 241, 0.2); }

/* Main Content Protocol */
.main-content {
    margin-left: 280px;
    padding: 3rem 2.5rem;
    min-height: 100vh;
    transition: all 0.1s ease;
    width: auto;
    max-width: 100%;
    overflow-x: hidden !important;
    display: block;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    z-index: 900;
    align-items: center;
    justify-content: space-between;
}

/* Responsive Adaptive Engine */
@media (max-width: 1200px) {
    .sidebar { width: 90px; padding: 2rem 0.5rem; text-align: center; }
    .sidebar h2 { font-size: 18px; margin-bottom: 2rem; }
    .sidebar .text, .sidebar h2 span { display: none !important; }
    .main-content { margin-left: 90px; padding: 2.5rem 1.5rem; }
    .nav-link { justify-content: center; padding: 0.9rem !important; gap: 0; }
    .nav-link i { font-size: 1.5rem; margin: 0 !important; }
}

@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .sidebar { transform: translateX(-100%); width: 280px; text-align: left; position: fixed; height: 100%; top: 0; left: 0; }
    .sidebar.active { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,0.1); }
    .sidebar .text, .sidebar h2 span { display: inline !important; }
    .main-content { margin-left: 0; width: 100%; padding: 6rem 1rem 2rem; }
    .nav-link { justify-content: flex-start; padding: 0.8rem 1.2rem !important; gap: 12px; }
    .nav-link i { font-size: 1.1rem; }
}

/* Inputs */
input, textarea, select {
    width: 100%;
    padding: 0.85rem 1.2rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    background: #f8fafc;
}

input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }

/* Badges */
.badge { padding: 0.4rem 1rem; border-radius: 99px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; display: inline-block; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Management Grids */
.firewall-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 30px; }
@media (max-width: 1024px) { .firewall-grid { grid-template-columns: 1fr; } }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
