/* Reset y Variables */
:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --sidebar-bg: #1e293b;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
}

/* Pantallas */
.screen {
    display: none;
    position: relative;
}

/* Login Screen */
#login-screen.active {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-message {
    color: var(--danger-color);
    margin-top: 10px;
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Botones */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-link {
    background: none;
    color: var(--primary-color);
    text-decoration: underline;
    padding: 5px;
    font-size: 14px;
}

.btn-link:hover {
    color: #1d4ed8;
}

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

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

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

/* App Screen */
#app-screen.active {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 18px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: var(--primary-color);
    color: white;
}

/* Menú desplegable */
.nav-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-group-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    user-select: none;
}

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

.nav-group-arrow {
    margin-left: auto;
    transition: transform 0.3s;
    font-size: 12px;
}

.nav-group.expanded .nav-group-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: rgba(0, 0, 0, 0.2);
}

.nav-group.expanded .nav-submenu {
    max-height: 500px;
}

.nav-subitem {
    display: block;
    padding: 10px 20px 10px 50px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 14px;
}

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

.nav-subitem.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: var(--primary-color);
    color: white;
}

/* Pestañas de configuración */
.config-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background: white;
    padding: 0;
    margin: 0;
}

.config-tab {
    padding: 15px 25px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.3s;
    position: relative;
    top: 2px;
}

.config-tab:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.config-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

#config-tab-content {
    min-height: 400px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.top-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

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

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

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background-color: var(--bg-color);
    font-weight: 600;
    color: var(--text-color);
}

table tr:hover {
    background-color: var(--bg-color);
}

/* Formularios */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1px));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0;
}

.stat-label {
    color: var(--text-light);
    font-size: 14px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.close {
    color: var(--text-light);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--text-color);
}

/* Pestañas (Tabs) */
.tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    bottom: -2px;
}

.tab-button:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.05);
}

.tab-button.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: transparent;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

