:root {
    --primary: #457992;
    --primary-dark: #345c6f;
    --primary-light: #48a7d4;
    --accent: #eab830;
    --accent-dark: #c99b24;
    --bg-body: #f4f7f6;
    --bg-card: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --border-radius: 12px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* Layout */
.sidebar {
    width: 260px;
    background: var(--primary);
    color: white;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
}

.sidebar .logo-container {
    margin-bottom: 3rem;
    text-align: center;
}

.sidebar .logo-container img {
    max-width: 160px;
    filter: brightness(0) invert(1);
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-link i {
    margin-right: 12px;
    font-size: 1.1rem;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link.logout {
    margin-top: auto;
    color: #ff7675;
}

/* Cards & Components */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    border-left: 5px solid var(--primary);
}

.stat-card.pending { border-left-color: var(--warning); }
.stat-card.resolved { border-left-color: var(--success); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 2px solid #f0f0f0;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

tr:hover td {
    background-color: #fcfcfc;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); }

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

.badge-pending { background: #fff3cd; color: #856404; }
.badge-process { background: #d1ecf1; color: #0c5460; }
.badge-resolved { background: #d4edda; color: #155724; }

.badge-low { background: #e2e8f0; color: #475569; }
.badge-medium { background: #fef3c7; color: #d97706; }
.badge-high { background: #fee2e2; color: #dc2626; }

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
}

/* Layout Helpers & Grids */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.ticket-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.dashboard-actions-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Mobile Tickets List (Card style) */
.mobile-tickets-list {
    display: none;
}

.mobile-ticket-card {
    background: #f8f9fa;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.mobile-ticket-card:not(:last-child) {
    margin-bottom: 0.25rem;
}

.mobile-ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 0.5rem;
}

.mobile-ticket-id {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.05rem;
}

.mobile-ticket-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.mobile-ticket-info {
    display: flex;
    align-items: center;
    color: var(--text-main);
}

.mobile-ticket-info i {
    width: 20px;
    margin-right: 8px;
    color: var(--primary);
    font-size: 1rem;
    text-align: center;
}

.mobile-ticket-info.date {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.mobile-ticket-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

/* Mobile Header & Overlay */
.mobile-header {
    display: none;
    background: var(--primary);
    color: white;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.mobile-header img {
    height: 28px;
    filter: brightness(0) invert(1);
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1005; /* Positioned above mobile-header (1000) */
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 1010; /* Positioned above overlay (1005) and mobile-header (1000) */
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem 1rem;
        margin-top: 60px;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .ticket-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .dashboard-header .btn {
        width: 100%;
        justify-content: center;
    }

    .dashboard-actions-group {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .table-container {
        display: none;
    }
    
    .mobile-tickets-list {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

/* Tabs & Type Badges */
.tab-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: #e9ecef;
    padding: 0.35rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    width: fit-content;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
    .tab-container {
        width: 100%;
        gap: 0.25rem;
    }
    .tab-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

.badge-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-type-incidencia {
    background-color: rgba(69, 121, 146, 0.1);
    color: var(--primary);
}

.badge-type-recomendacion {
    background-color: rgba(234, 184, 48, 0.15);
    color: #b28004;
}

.card.recommendation-accent {
    border-left: 5px solid var(--accent);
}

/* ===== Department-specific theming ===== */
.department-informatica {
    --dept-color: #457992;
    --dept-light: rgba(69, 121, 146, 0.08);
}

.department-diseno {
    --dept-color: #e0556a;
    --dept-light: rgba(224, 85, 106, 0.08);
}

.dept-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dept-badge-informatica {
    background: rgba(69, 121, 146, 0.1);
    color: #345c6f;
}

.dept-badge-diseno {
    background: rgba(224, 85, 106, 0.1);
    color: #b33a4a;
}

.academy-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #eef2f7;
    color: var(--text-muted);
}

/* ===== Nav Separator ===== */
.nav-separator {
    height: 1px;
    background: rgba(255,255,255,0.15);
    margin: 0.5rem 0;
    list-style: none;
    pointer-events: none;
}

@media (max-width: 768px) {
    .nav-separator {
        margin: 0.25rem 0;
    }
}

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.filter-bar select,
.filter-bar input {
    width: auto;
    min-width: 140px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.filter-bar input {
    flex: 1 1 200px;
    max-width: 260px;
}

.filter-bar .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.filter-bar .btn-reset {
    background: #e2e8f0;
    color: #475569;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    min-height: 0;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.6rem;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.filter-tag:hover {
    background: var(--primary-dark);
}

.filter-tag i {
    font-size: 0.7rem;
    margin-left: 2px;
}

/* ===== File Upload ===== */
.file-upload-area {
    border: 2px dashed #ccc;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s;
    margin-bottom: 0.75rem;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary-light);
    background: rgba(72, 167, 212, 0.05);
}

.file-upload-area i {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

.file-upload-area p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.file-upload-area p strong {
    color: var(--primary);
}

.file-upload-area input[type="file"] {
    display: none;
}

.file-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.file-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f0f4f8;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-main);
}

.file-list li .remove-file {
    cursor: pointer;
    color: var(--danger);
    font-size: 0.85rem;
}

.attached-files {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.attached-file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.attached-file-item:hover {
    background: #eef2f7;
}

.attached-file-item .file-icon {
    font-size: 1.3rem;
    color: var(--primary);
    width: 24px;
    text-align: center;
}

.attached-file-item .file-info {
    flex: 1;
    min-width: 0;
}

.attached-file-item .file-name {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attached-file-item .file-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.attached-file-item .file-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.attached-file-item .file-actions a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.attached-file-item .file-actions a:hover {
    color: var(--primary);
}

/* ===== Infobox ===== */
.infobox {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.infobox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.infobox-item i {
    color: var(--primary);
    width: 16px;
    text-align: center;
}

/* ===== Search highlight ===== */
.search-highlight {
    background: #fef08a;
    padding: 0 2px;
    border-radius: 2px;
}

/* ===== Sortable Columns ===== */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.sortable:hover {
    color: var(--primary);
}

th.sortable i {
    margin-left: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

th.sortable i.sorted {
    color: var(--primary);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.2;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ===== Responsive additions ===== */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-bar select,
    .filter-bar input {
        width: 100%;
        max-width: none;
    }
    
    .filter-bar .btn {
        width: 100%;
        justify-content: center;
    }
    
    .infobox {
        flex-direction: column;
        gap: 0.4rem;
    }
}


