:root {
    /* Páprica Colors */
    --color-primary: #E50914; /* Red */
    --color-primary-hover: #F6121D;
    --color-secondary: #FFB800; /* Yellow */
    --color-secondary-hover: #FFC733;
    
    /* Dark Theme */
    --color-bg: #121212;
    --color-surface: #1E1E1E;
    --color-surface-light: #2A2A2A;
    --color-surface-hover: #333333;
    
    /* Text */
    --color-text-main: #FFFFFF;
    --color-text-muted: #B3B3B3;
    --color-text-dark: #121212;
    
    /* Status */
    --color-success: #22C55E;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;
    
    /* Metrics */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --color-bg: #F3F4F6;
    --color-surface: #FFFFFF;
    --color-surface-light: #E5E7EB;
    --color-surface-hover: #D1D5DB;
    
    --color-text-main: #1F2937;
    --color-text-muted: #6B7280;
    
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 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;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }

p {
    color: var(--color-text-muted);
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-wrapper {
    flex: 1;
    padding: 2rem 0;
    animation: fadeIn 0.4s ease-out;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* UI Elements */
.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: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text-main);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--color-text-dark);
}

.btn-secondary:hover {
    background-color: var(--color-secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 184, 0, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--color-surface-light);
    color: var(--color-text-main);
}

.btn-outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: rgba(229, 9, 20, 0.05);
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--color-primary);
    background: rgba(229, 9, 20, 0.1);
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--color-surface-light);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--color-text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.2);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23B3B3B3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

/* Cards */
.card {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255,255,255,0.05);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(255,255,255,0.1);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    background-color: var(--color-surface-light);
    border-radius: var(--radius-full);
    height: 8px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-full);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background-color: rgba(34, 197, 94, 0.15); color: var(--color-success); }
.badge-warning { background-color: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.badge-danger { background-color: rgba(239, 68, 68, 0.15); color: var(--color-danger); }
.badge-primary { background-color: rgba(229, 9, 20, 0.15); color: var(--color-primary); }

/* Header/Navbar (Refactored to App Layout) */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background-color: var(--color-surface);
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    margin-bottom: 2.5rem;
    justify-content: flex-start;
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-main);
    text-decoration: none;
    white-space: nowrap;
}

.sidebar .brand i {
    color: var(--color-primary);
    font-size: 1.8rem;
}

.sidebar .brand span {
    background: linear-gradient(90deg, var(--color-text-main), var(--color-text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar .nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

.sidebar .nav-tab {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    background-color: transparent;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.95rem;
    gap: 0.75rem;
}

.sidebar .nav-tab i {
    font-size: 1.2rem;
}

.sidebar .nav-tab:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--color-text-main);
}

.sidebar .nav-tab.active {
    background-color: rgba(229, 9, 20, 0.1);
    color: var(--color-primary);
    font-weight: 600;
}

.top-header {
    height: 70px;
    background-color: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-profile-sm {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--color-surface-light);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.05);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

/* Login Page */
.login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(229, 9, 20, 0.15), transparent 40%),
                radial-gradient(circle at bottom left, rgba(255, 184, 0, 0.1), transparent 40%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
    padding: 3rem 2rem;
}

.login-logo {
    font-size: 4rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    display: inline-block;
}

/* Dashboard / Admin */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: rgba(229, 9, 20, 0.1);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-info h3 {
    font-size: 2rem;
    margin: 0;
}

/* Employee List */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: var(--color-surface);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.filters-bar .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

.search-input-wrapper {
    position: relative;
    flex: 2;
    min-width: 250px;
}

.search-input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
}

.search-input-wrapper input {
    padding-left: 2.5rem;
}

.employee-table-wrapper {
    overflow-x: auto;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
}

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

.employee-table th, .employee-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.employee-table th {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.employee-table tr:hover td {
    background-color: var(--color-surface-light);
}

.employee-name-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.employee-name-cell .avatar {
    width: 40px;
    height: 40px;
}

/* Profile / Detail View */
.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 0 20px rgba(229, 9, 20, 0.4);
}

.profile-info h1 {
    margin-bottom: 0.25rem;
}

.profile-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.training-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.training-card {
    position: relative;
    overflow: hidden;
}

.training-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--color-surface-light);
}

.training-card.completed::before {
    background-color: var(--color-success);
}

.training-card.pending::before {
    background-color: var(--color-warning);
}

.training-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.grade-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-success);
    border: 2px solid var(--color-success);
}

.grade-circle.high { color: var(--color-success); border-color: var(--color-success); background: rgba(34, 197, 94, 0.1); }
.grade-circle.medium { color: var(--color-warning); border-color: var(--color-warning); background: rgba(245, 158, 11, 0.1); }
.grade-circle.low { color: var(--color-danger); border-color: var(--color-danger); background: rgba(239, 68, 68, 0.1); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--color-surface);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    transform: translateY(20px);
    transition: var(--transition);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--color-surface-light);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--color-text-muted);
    transition: var(--transition);
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-100 { width: 100%; }

/* Calendar */
.calendar-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: var(--color-text-muted);
    padding: 0.5rem;
    font-size: 0.85rem;
}

.calendar-day {
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    min-height: 100px;
    padding: 0.5rem;
}

.calendar-day.empty {
    background: transparent;
    border-color: transparent;
}

.calendar-day-number {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

.schedule-item {
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    margin-bottom: 0.25rem;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0.25rem;
    position: relative;
    cursor: pointer;
}

.schedule-item.lv {
    background: rgba(229, 9, 20, 0.15);
    border-left: 3px solid var(--color-primary);
}

.schedule-item.normal {
    border-left: 3px solid var(--color-secondary);
}

.schedule-item-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.schedule-list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.schedule-list-item {
    background: var(--color-surface-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--color-secondary);
}

.schedule-list-item.lv {
    border-left-color: var(--color-primary);
}

.schedule-list-item-info h4 {
    margin: 0 0 0.25rem 0;
}

.schedule-list-item-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .employee-table th:not(:first-child):not(:last-child), 
    .employee-table td:not(:first-child):not(:last-child) {
        display: none;
    }

    .app-layout {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding: 1rem;
    }
    
    .sidebar .nav-links {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .sidebar .nav-tab {
        white-space: nowrap;
    }
    
    .sidebar .brand {
        margin-bottom: 1rem;
    }
    
    .main-content {
        height: auto;
        overflow-y: visible;
    }

    .calendar-grid-wrapper {
        overflow-x: auto;
        padding-bottom: 1rem;
    }

    .calendar-grid {
        min-width: 700px; /* Force scroll instead of breaking to 1 column for calendar view */
    }

    form .grid-2 {
        grid-template-columns: 1fr !important;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    .schedule-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .schedule-item-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
}
