:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glass: rgba(30, 41, 59, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar Sutil */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Loader Spinner */
.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--danger);
    color: white;
}

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

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3rem;
}

.logo img {
    max-width: 100%;
    height: auto;
    max-height: 80px;
    object-fit: contain;
}

.logo .icon,
.logo h1 {
    display: none;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
}

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

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.sidebar-footer {
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Content Area */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
    max-width: calc(100vw - var(--sidebar-width));
}

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

header h2 {
    font-size: 2rem;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid var(--border);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-card .trend {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.trend.up {
    color: var(--success);
}

.trend.down {
    color: var(--danger);
}

.calc-total-value {
    font-size: 2.5rem;
    font-weight: 700;
    transition: font-size 0.3s ease;
}

/* Table Styling */
.card-container {
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    overflow: hidden;
}

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

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

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

td {
    white-space: nowrap;
    text-overflow: ellipsis;
}

th {
    padding: 0.75rem 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

/* Clases de ancho de columnas */
.col-date {
    width: 140px;
}

.col-time {
    width: 100px;
}

.col-double {
    width: 60px;
    text-align: center;
}

.col-num {
    width: 90px;
}

.col-hours {
    width: 80px;
    font-weight: 600;
}

.col-action {
    width: 50px;
    text-align: center;
}

@media (max-width: 768px) {
    .table-container table {
        min-width: 700px;
    }
}

tr:last-child td {
    border-bottom: none;
}

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

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

input,
select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

select option {
    background-color: var(--bg-card);
    color: var(--text-main);
}

.btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.btn:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: #334155;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-whatsapp {
    background: #25D366;
    color: white !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

.btn-whatsapp:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 211, 102, 0.3);
}

.btn-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Grid Layouts for Content */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-animate {
    animation: fadeIn 0.4s ease forwards;
}

/* Tags */
.tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tag-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.tag-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Import Styles */
.import-zone {
    border: 2px dashed var(--border);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.import-zone:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.preview-table {
    margin-top: 2rem;
    max-height: 400px;
    overflow-y: auto;
}

dialog::backdrop {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    animation: fadeIn 0.3s ease-out;
}

dialog {
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    background: var(--bg-card);
    padding: 0;
    max-width: 95vw;
    width: 900px;
    /* Más ancho */
    max-height: 90vh;
    margin: auto;
    color: white;
    overflow-x: auto;
}

dialog[open] {
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content {
    padding: 2.5rem;
    color: white;
}

/* --- Login Page --- */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.login-card h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.login-form {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.login-input-group {
    text-align: left;
}

.login-input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    margin-left: 0.3rem;
    font-weight: 500;
}

.login-input-group input {
    width: 100%;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
}

.login-input-group input:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

.login-btn {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.login-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.4);
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    padding: 0.8rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: none;
}

/* --- Mobile Menu Buttons --- */
.menu-toggle,
.menu-close {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: white;
    font-size: 1.5rem;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    z-index: 1001;
}

.menu-toggle:hover,
.menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- Responsiveness --- */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        left: -280px;
        transition: left 0.3s ease;
        width: 280px;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
        z-index: 1100;
    }

    .sidebar.active {
        left: 0;
    }

    .content {
        margin-left: 0;
        padding: 1.5rem;
        max-width: 100vw;
    }

    .menu-toggle {
        display: block;
    }

    .menu-close {
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
    }

    header {
        margin-bottom: 2rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    header h2 {
        font-size: 1.5rem;
    }

    .user-profile {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
        margin-bottom: 2rem;
    }

    .stat-card {
        padding: 1.25rem !important;
        min-width: 0 !important;
    }

    .stat-card .value {
        font-size: 1.5rem !important;
    }

    .stat-card h3 {
        font-size: 0.85rem !important;
    }

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

    .card-container {
        padding: 1rem;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .table-header .btn {
        width: 100%;
        justify-content: center;
    }

    #employee-status-filter {
        width: 100%;
    }

    /* Form responsiveness */
    .modal-content {
        padding: 1.5rem;
    }

    dialog {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .card-container {
        padding: 1rem;
        overflow-x: hidden;
    }

    td input[type="date"] {
        min-width: 130px;
    }

    .table-container table {
        min-width: 700px;
    }

    /* Dashboard mobile scroll fix */
    .stats-grid {
        overflow-x: hidden;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 2rem 1.5rem;
    }

    .login-card h1 {
        font-size: 1.8rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    th,
    td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .nav-item {
        padding: 10px 12px;
    }

    .calc-total-value {
        font-size: 1.5rem !important;
    }
}

/* --- Password Toggle --- */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100% !important;
    padding-right: 45px !important;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: var(--transition);
    z-index: 10;
}

.password-toggle:hover {
    color: var(--primary);
}