@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    /* Blue 500 */
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    min-height: 100vh;
    overflow-x: hidden;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    padding: 1rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: .55rem .75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: .15rem;
    font-size: .85rem;
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
}

.nav-link i {
    margin-right: 0.6rem;
    width: 18px;
    font-size: .85rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card-title {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: 1rem;
    border: var(--glass-border);
    overflow: hidden;
    overflow-x: auto;
    /* Allow horizontal scroll */
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* Force scroll on small screens */
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    border-bottom: var(--glass-border);
    font-weight: 500;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-open {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.status-closed {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

/* Mobile Header & Responsive Styles */
.mobile-header {
    display: none;
    background: rgba(15, 23, 42, 0.95);
    padding: 1rem;
    align-items: center;
    justify-content: space-between;
    border-bottom: var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 101;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

#btnMobileMenu {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Logic for Mobile Devices */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .layout {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        /* Hide offscreen */
        transition: left 0.3s ease;
        height: 100%;
        width: 250px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        padding: 1rem;
        padding-top: 0;
        /* Header already handles space */
    }

    .header {
        display: none;
        /* Hide Desktop Header */
    }

    /* Adjust Cards for touch */
    .card {
        padding: 1rem;
    }

    /* Modal Mobile */
    .modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-width: none;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .detail-label {
        font-size: 0.8rem;
    }

    /* Larger buttons */
    .btn-icon {
        padding: 0.75rem;
        font-size: 1.2rem;
    }
}

/* User Role Badges */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.badge.admin {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge.manager {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge.monitor {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge.doc {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}