﻿/* --- 1. Variables Globales y Reseteo Básico --- */
:root {
    --primary-color: #2c3e50; /* Azul oscuro casi negro */
    --secondary-color: #3498db; /* Azul brillante */
    --success-color: #27ae60; /* Verde */
    --danger-color: #e74c3c; /* Rojo */
    --light-gray: #ecf0f1; /* Gris muy claro de fondo */
    --medium-gray: #bdc3c7; /* Gris para bordes */
    --dark-gray: #7f8c8d; /* Gris para texto secundario */
    --shadow-soft: 0 4px 15px rgba(0,0,0,0.08);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.12);
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--light-gray);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    width: 100%;
    max-width: 800px;
    background-color: white;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    padding: 25px;
    transition: box-shadow 0.3s ease;
}

    .container:hover {
        box-shadow: var(--shadow-hover);
    }

.hidden {
    display: none !important;
}

hr {
    border: none;
    border-top: 1px solid var(--light-gray);
    margin: 20px 0;
}

/* --- 2. Estilos para la Página de Login (Diseño Mejorado) --- */
.login-body {
    background: linear-gradient(135deg, var(--light-gray) 0%, #d5dbdb 100%);
    align-items: center;
    padding: 40px 20px;
    min-height: 100vh;
}

.login-container {
    padding: 50px 40px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    max-width: 400px;
    width: 100%;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

    .login-container:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-hover);
    }

    .login-container h1 {
        color: var(--primary-color);
        margin-bottom: 30px;
        font-size: 2.2em;
        font-weight: 300;
        letter-spacing: -0.5px;
    }

/* --- 3. Estilos para Formularios (Login y Crear Usuario) --- */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

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

    .form-group input,
    #create-user-container select {
        width: 100%;
        padding: 12px;
        font-size: 1em;
        border: 1px solid var(--medium-gray);
        border-radius: 8px;
        box-sizing: border-box;
        transition: all 0.3s;
    }

        .form-group input:focus,
        #create-user-container select:focus {
            outline: none;
            border-color: var(--secondary-color);
            box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
        }

.error-message {
    color: var(--danger-color);
    margin-top: 15px;
    font-weight: 500;
}

/* --- 4. Estilos para Botones (Unificados) --- */
.sucursal-button {
    display: block;
    width: 100%;
    padding: 20px;
    font-size: 1.5em;
    font-weight: 500;
    margin: 15px 0;
    border: none;
    border-radius: 8px;
    color: white;
    background-color: var(--secondary-color);
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

    .sucursal-button:hover {
        background-color: #2980b9;
        transform: translateY(-1px);
    }

.login-button {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    color: white;
    background-color: var(--success-color);
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

    .login-button:hover {
        background-color: #229954;
        transform: translateY(-1px);
    }

.admin-button {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    color: white;
    background-color: var(--primary-color);
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.3s, transform 0.2s;
}

    .admin-button:hover {
        background-color: #1a252f;
        transform: translateY(-1px);
    }

.change-password-button {
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    color: white;
    background-color: var(--secondary-color);
    cursor: pointer;
    transition: background-color 0.3s;
}

    .change-password-button:hover {
        background-color: #2980b9;
    }

#logout-button {
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    color: white;
    background: linear-gradient(135deg, var(--danger-color) 0%, #c0392b 100%);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

    #logout-button:hover {
        background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
    }

.back-btn {
    background: linear-gradient(135deg, white 0%, #f8f9fa 100%);
    border: 1px solid var(--medium-gray);
    color: var(--primary-color);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    margin-right: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

    .back-btn:hover {
        background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
        color: white;
        border-color: var(--secondary-color);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    }

/* --- 5. Estilos de la Interfaz Principal --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#welcome-message {
    font-weight: 500;
    color: var(--primary-color);
}

#sucursal-selection-view h1 {
    color: var(--primary-color);
}

.header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 15px;
}

#sucursal-name {
    color: var(--primary-color);
    margin: 0;
}

/* --- 6. Estilos de Búsqueda y Filtros --- */
.search-container {
    margin-bottom: 15px;
}

#search-bar {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1em;
    border: 1px solid var(--medium-gray);
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.3s;
}

    #search-bar:focus {
        outline: none;
        border-color: var(--secondary-color);
        box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
    }

.filter-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-button {
    flex-grow: 1;
    padding: 10px;
    font-size: 1em;
    border: 1px solid var(--dark-gray);
    border-radius: 8px;
    background-color: #fff;
    color: var(--dark-gray);
    cursor: pointer;
    transition: all 0.3s;
}

    .filter-button.active {
        background-color: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
    }

/* --- 7. Estilos de la Lista de Productos y Usuarios --- */
#product-list,
#user-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    list-style: none;
    padding: 0;
}

.product-item,
.user-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s;
}

    .product-item:hover,
    .user-list-item:hover {
        box-shadow: var(--shadow-soft);
        transform: translateY(-1px);
    }

    .product-item p,
    .user-list-item span {
        margin: 0;
        font-size: 1.2em;
        color: var(--primary-color);
        font-weight: 500;
    }

/* --- 8. Componentes Específicos (Loader, Toggle Switch) --- */
.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--secondary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--danger-color);
    transition: .4s;
    border-radius: 34px;
}

    .slider:before {
        position: absolute;
        content: "";
        height: 26px;
        width: 26px;
        left: 4px;
        bottom: 4px;
        background-color: white;
        transition: .4s;
        border-radius: 50%;
    }

input:checked + .slider {
    background-color: var(--success-color);
}

    input:checked + .slider:before {
        transform: translateX(26px);
    }
