/* MIHNAD DASHBOARD - NEURAL GLASS DESIGN SYSTEM */
:root {
    /* Colors */
    --bg: #f5f5f7;
    --surface: #ffffff;
    --panel: rgba(0, 0, 0, 0.02);
    --panel-border: rgba(0, 0, 0, 0.08);
    --panel-active: rgba(0, 0, 0, 0.04);

    --accent: #FFC107;
    --accent-glow: rgba(255, 193, 7, 0.3);
    --accent-text: #000000;

    --text: #1d1d1f;
    --text-m: #48484a;
    --text-s: #86868b;

    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;

    /* Spacing & Radius */
    --radius-s: 12px;
    --radius-m: 20px;
    --radius-l: 32px;

    /* Layout */
    --sidebar-width: 280px;

    /* Effects */
    --ease: cubic-bezier(0.25, 1, 0.5, 1);
    --blur: blur(24px);
}

[data-theme="dark"] {
    --bg: #050505;
    --surface: #0d0d0d;
    --panel: rgba(255, 255, 255, 0.03);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-active: rgba(255, 255, 255, 0.06);
    --text: #ffffff;
    --text-m: #a1a1a6;
    --text-s: #86868b;
    --accent-glow: rgba(255, 193, 7, 0.15);
}

/* --- Global Reset & Typography --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    transition: background 0.5s var(--ease);
    min-height: 100vh;
}

/* --- Layout Structure --- */
.neural-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.neural-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--panel-border);
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.4s var(--ease);
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 48px;
}

.brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.brand-name {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -1px;
    color: var(--text);
}

.nav-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-s);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 24px 16px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-s);
    color: var(--text-m);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.25s var(--ease);
}

.nav-item:hover {
    background: var(--panel);
    color: var(--text);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--accent);
    color: var(--accent-text);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.nav-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--panel-border);
}

.logout-item {
    color: #ff453a;
    margin-top: 24px;
}

/* Main Content Area */
.master-viewport {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px 60px;
    max-width: 1600px;
    width: 100%;
    /* Ensure full width availability */
    transition: margin 0.4s var(--ease);
}

/* Header */
.neural-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 48px;
}

.header-info h1 {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -2.5px;
    line-height: 1;
}

.header-info p {
    color: var(--text-m);
    margin-top: 10px;
    font-weight: 500;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Controls & Buttons */
.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    transition: 0.3s var(--ease);
}

.control-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.btn-action {
    padding: 12px 24px;
    background: var(--accent);
    color: var(--accent-text);
    border-radius: var(--radius-s);
    text-decoration: none;
    font-weight: 800;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s var(--ease);
    box-shadow: 0 8px 24px var(--accent-glow);
    border: none;
    cursor: pointer;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px var(--accent-glow);
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-s);
    color: var(--text);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.3s var(--ease);
    flex: 1;
}

.btn-secondary:hover {
    background: var(--panel-active);
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent);
    color: var(--accent-text);
    border-radius: var(--radius-s);
    font-weight: 800;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: 0.3s var(--ease);
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-danger {
    padding: 12px 24px;
    background: var(--error);
    color: white;
    border-radius: var(--radius-s);
    font-weight: 800;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: 0.3s var(--ease);
    flex: 1;
}

.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-2px);
}

/* --- Components --- */

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 8px;
    overflow-x: auto;
    /* Allow horizontal scroll on mobile */
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.tabs::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar Chrome/Safari */

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: var(--radius-s);
    color: var(--text-m);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.3s var(--ease);
    position: relative;
    white-space: nowrap;
    /* Prevent text wrapping */
    flex-shrink: 0;
    /* Prevent shrinking */
}

.tab-btn:hover {
    background: var(--panel);
    color: var(--text);
}

.tab-btn.active {
    background: var(--accent);
    color: var(--accent-text);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

/* Cards (Bento/Stats) */
.glass-card {
    background: var(--panel);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-m);
    padding: 32px;
    transition: all 0.3s var(--ease);
}

/* Tables (General) */
.data-container,
.users-table-container,
.events-table-container {
    background: var(--surface);
    border-radius: var(--radius-l);
    border: 1px solid var(--panel-border);
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.neural-table,
.users-table,
.events-table {
    width: 100%;
    border-collapse: collapse;
}

.neural-table th,
.users-table th,
.events-table th {
    text-align: left;
    padding: 18px 32px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-s);
    background: var(--panel);
    border-bottom: 1px solid var(--panel-border);
}

.neural-table td,
.users-table td,
.events-table td {
    padding: 20px 32px;
    border-bottom: 1px solid var(--panel-border);
    font-size: 0.95rem;
    font-weight: 500;
    vertical-align: middle;
}

/* Table Actions */
.table-actions,
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.table-btn,
.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-m);
    transition: 0.2s var(--ease);
}

.table-btn:hover,
.action-btn:hover {
    background: var(--panel-active);
    color: var(--text);
    transform: translateY(-2px);
}

.table-btn.edit:hover,
.action-btn.edit:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.table-btn.delete:hover,
.action-btn.delete:hover {
    color: var(--error);
    border-color: var(--error);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s var(--ease);
}

.modal-container {
    background: var(--surface);
    border-radius: var(--radius-l);
    border: 1px solid var(--panel-border);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s var(--ease);
}

.modal-header {
    padding: 28px 32px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-m);
    transition: 0.2s var(--ease);
}

.modal-close:hover {
    background: var(--panel-active);
}

.modal-content {
    padding: 32px;
}

.modal-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-s);
    color: var(--text);
    font-size: 0.95rem;
    transition: 0.3s var(--ease);
    font-family: 'Inter', sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--panel-active);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    grid-column: 1 / -1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Responsive Logic --- */

/* Mobile Navigation & Layout */
@media (max-width: 900px) {
    .neural-nav {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .neural-nav.active {
        transform: translateX(0);
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.4);
    }

    .master-viewport {
        margin-left: 0;
        padding: 32px 20px;
    }

    #menuToggle {
        display: flex !important;
    }

    .header-info h1 {
        font-size: 1.8rem;
    }

    .header-info p {
        font-size: 0.9rem;
    }

    .header-controls {
        gap: 12px;
    }

    /* Modal Adjustments */
    .modal-form {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: 1;
    }
}

@media (max-width: 768px) {

    /* Table to Card Transformation */
    .neural-table thead,
    .users-table thead,
    .events-table thead {
        display: none;
    }

    .neural-table,
    .neural-table tbody,
    .neural-table tr,
    .neural-table td,
    .users-table,
    .users-table tbody,
    .users-table tr,
    .users-table td,
    .events-table,
    .events-table tbody,
    .events-table tr,
    .events-table td {
        display: block;
        width: 100%;
    }

    .neural-table tr,
    .users-table tr,
    .events-table tr {
        margin-bottom: 24px;
        border-radius: var(--radius-m);
        border: 1px solid var(--panel-border);
        background: var(--surface);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }

    .neural-table td,
    .users-table td,
    .events-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 16px 20px;
        border-bottom: 1px solid var(--panel-border);
    }

    .neural-table td:last-child,
    .users-table td:last-child,
    .events-table td:last-child {
        border-bottom: none;
    }

    /* Add labels using data-label attribute */
    .neural-table td::before,
    .users-table td::before,
    .events-table td::before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 800;
        text-transform: uppercase;
        color: var(--text-s);
        letter-spacing: 0.5px;
        margin-right: 15px;
    }

    /* Specific styling for the first cell (Main entity) to look like a header */
    .neural-table td:first-child,
    .users-table td:first-child,
    .events-table td:first-child {
        background: var(--panel);
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        padding: 24px;
        border-bottom: 1px solid var(--panel-border);
    }

    .neural-table td:first-child::before,
    .users-table td:first-child::before,
    .events-table td:first-child::before {
        display: none;
        /* Hide label for the main header cell */
    }

    /* Filters on mobile */
    .filter-ribbon {
        flex-direction: column;
    }

    .search-container {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .master-viewport {
        padding: 24px 16px;
        overflow-x: hidden;
    }

    .header-controls {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .control-btn#themeToggle {
        position: absolute;
        top: 24px;
        right: 16px;
    }

    .btn-action {
        width: 100%;
        justify-content: center;
    }

    .modal-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
    }

    /* Notifications */
    .notification {
        width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        transform: translateY(-150%);
    }

    .notification.show {
        transform: translateY(0);
    }
}

/* --- Page Specific Styles --- */

/* Filters (Articles/Events) */
.filter-ribbon {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.search-container {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-container input {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-s);
    padding: 14px 20px 14px 48px;
    color: var(--text);
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: 0.3s var(--ease);
}

.search-container input:focus {
    border-color: var(--accent);
    background: var(--panel-active);
}

.search-container i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-s);
}

.select-glass {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-s);
    padding: 0 20px;
    color: var(--text);
    font-weight: 600;
    height: 48px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: 0.3s var(--ease);
}

.select-glass:focus {
    border-color: var(--accent);
    outline: none;
}

/* Entity Metas (Users/Articles) */
.article-meta,
.user-info-cell {
    display: flex;
    align-items: center;
    gap: 14px;
}

.article-image,
.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--panel-active);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-m);
    flex-shrink: 0;
}

.article-image img,
.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
}

.article-info h4,
.user-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 2px;
}

.article-info span,
.user-email {
    font-size: 0.85rem;
    color: var(--text-m);
    font-weight: 500;
}

/* Badges & Tags */
.category-tag {
    font-size: 0.7rem;
    font-weight: 950;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 4px 10px;
    border-radius: 100px;
    display: inline-block;
}

.role-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.role-admin {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.role-editor {
    background: rgba(255, 193, 7, 0.1);
    color: var(--accent);
}

.role-viewer {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-s);
}

.status-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-m);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-active {
    background-color: var(--success);
}

.status-inactive {
    background-color: var(--text-s);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    background: var(--surface);
    border-radius: var(--radius-m);
    border: 1px solid var(--panel-border);
}

.empty-state i {
    width: 64px;
    height: 64px;
    color: var(--text-s);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text);
}

.empty-state p {
    color: var(--text-m);
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-s);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateX(150%);
    transition: transform 0.4s var(--ease);
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--error);
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.notification-message {
    font-size: 0.85rem;
    color: var(--text-m);
}