/* =====================================================
   SUCURSAL JIREH - Sistema de Gestión
   Hoja de estilos principal
   ===================================================== */

/* ------ Reset & Variables ------ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --clr-bg-start:    #0f0c29;
    --clr-bg-mid:      #1a1060;
    --clr-bg-end:      #24243e;

    --clr-primary:     #6C63FF;
    --clr-secondary:   #3ECFCF;
    --clr-accent:      #a78bfa;

    --clr-surface:     rgba(255,255,255,0.07);
    --clr-surface-hover: rgba(255,255,255,0.12);
    --clr-border:      rgba(255,255,255,0.15);

    --clr-text:        #f0f0f8;
    --clr-text-muted:  #a0a0c0;
    --clr-error:       #ff6b6b;
    --clr-success:     #43e97b;

    --radius-card:     1.5rem;
    --radius-input:    0.75rem;
    --radius-btn:      0.75rem;

    --shadow-card: 0 25px 60px rgba(0,0,0,0.5),
                   0 8px 20px rgba(108,99,255,0.25);
    --shadow-btn:  0 8px 24px rgba(108,99,255,0.5);

    --transition: 0.25s ease;
    --font: 'Inter', system-ui, sans-serif;
}

html { font-size: 16px; }

body {
    font-family: var(--font);
    background: linear-gradient(135deg, var(--clr-bg-start), var(--clr-bg-mid), var(--clr-bg-end));
    min-height: 100vh;
    color: var(--clr-text);
    overflow-x: hidden;
}

/* ------ Fondo animado ------ */
.bg-animated {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    animation: floatUp linear infinite;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
}

.bubble-1 { width: 320px; height: 320px; left: -80px;  bottom: -80px;  animation-duration: 18s; animation-delay: 0s;   }
.bubble-2 { width: 200px; height: 200px; right: -40px; top: 10%;      animation-duration: 22s; animation-delay: 4s;   }
.bubble-3 { width: 140px; height: 140px; left: 30%;   bottom: -50px;  animation-duration: 15s; animation-delay: 8s;   }
.bubble-4 { width: 280px; height: 280px; right: 15%;  bottom: -120px; animation-duration: 20s; animation-delay: 2s;   }
.bubble-5 { width: 100px; height: 100px; left: 10%;   top: -30px;     animation-duration: 13s; animation-delay: 6s;   }

@keyframes floatUp {
    0%   { transform: translateY(0)    rotate(0deg);   opacity: 0.12; }
    50%  { opacity: 0.18; }
    100% { transform: translateY(-110vh) rotate(720deg); opacity: 0;    }
}

/* =====================================================
   LOGIN
   ===================================================== */
.login-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--clr-surface);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-card);
    padding: 2.75rem 2.5rem;
    box-shadow: var(--shadow-card);
    animation: cardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(28px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* Header */
.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.login-logo {
    width: 68px;
    height: 68px;
    animation: pulse 3s ease-in-out infinite;
}

.login-logo svg { width: 100%; height: 100%; }

@keyframes pulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(108,99,255,0.5)); }
    50%       { filter: drop-shadow(0 0 20px rgba(62,207,207,0.7)); }
}

.login-title {
    font-size: 1.65rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--clr-primary), var(--clr-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--clr-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.45rem; }

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--clr-text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 0.9rem;
    color: var(--clr-text-muted);
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: color var(--transition);
}

.form-input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-input);
    padding: 0.85rem 2.8rem 0.85rem 2.8rem;
    font-size: 0.95rem;
    font-family: var(--font);
    color: var(--clr-text);
    outline: none;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.form-input::placeholder { color: rgba(160,160,192,0.55); }

.form-input:focus {
    border-color: var(--clr-primary);
    background: rgba(108,99,255,0.1);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.2);
}

.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--clr-primary);
}

.toggle-pwd {
    position: absolute;
    right: 0.9rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--clr-text-muted);
    display: flex;
    align-items: center;
    padding: 0;
    transition: color var(--transition);
}

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

/* Alert box */
.alert-box {
    font-size: 0.875rem;
    padding: 0;
    border-radius: 0.6rem;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.alert-box.show {
    padding: 0.75rem 1rem;
    max-height: 80px;
    opacity: 1;
}

.alert-box.error   { background: rgba(255,107,107,0.15); border: 1px solid rgba(255,107,107,0.4); color: #0044cc; font-weight: 600; }
.alert-box.success { background: rgba(67,233,123,0.15);  border: 1px solid rgba(67,233,123,0.4);  color: #0044cc; font-weight: 600; }

/* Botón */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.95rem;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    color: #fff;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-btn);
    cursor: pointer;
    box-shadow: var(--shadow-btn);
    transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
    margin-top: 0.25rem;
}

.btn-login::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background var(--transition);
}

.btn-login:hover:not(:disabled)::after { background: rgba(255,255,255,0.08); }

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(108,99,255,0.6);
}

.btn-login:active:not(:disabled) { transform: translateY(0); }

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}

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

.btn-login.loading .spinner { display: block; }
.btn-login.loading #btnText  { display: none; }

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 1.75rem;
    font-size: 0.75rem;
    color: rgba(160,160,192,0.5);
    letter-spacing: 0.03em;
}

/* =====================================================
   DASHBOARD
   ===================================================== */
.dash-body {
    background: linear-gradient(135deg, var(--clr-bg-start), var(--clr-bg-mid), var(--clr-bg-end));
    min-height: 100vh;
}

.dash-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--clr-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dash-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.dash-logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--clr-primary), var(--clr-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dash-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dash-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.dash-username {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--clr-text);
}

.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-admin   { background: rgba(108,99,255,0.25); color: #b8b4ff; border: 1px solid rgba(108,99,255,0.5); }
.badge-vendedor { background: rgba(62,207,207,0.2); color: #7deaea; border: 1px solid rgba(62,207,207,0.4); }

.btn-logout {
    background: rgba(255,107,107,0.15);
    border: 1px solid rgba(255,107,107,0.3);
    color: #ff9a9a;
    border-radius: 0.5rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.btn-logout:hover { background: rgba(255,107,107,0.3); transform: translateY(-1px); }

/* Main */
.dash-main {
    flex: 1;
    padding: 2.5rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.dash-welcome {
    margin-bottom: 2.5rem;
    animation: cardIn 0.5s ease both;
}

.dash-welcome-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--clr-text), var(--clr-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.dash-welcome-sub {
    color: var(--clr-text-muted);
    font-size: 1rem;
}

/* Módulos */
.dash-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.module-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-card);
    padding: 1.75rem 1.5rem;
    backdrop-filter: blur(16px);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
    animation: cardIn 0.5s ease both;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.module-card:hover:not(.module-locked) {
    transform: translateY(-5px);
    background: var(--clr-surface-hover);
    border-color: rgba(108,99,255,0.45);
    box-shadow: 0 12px 32px rgba(108,99,255,0.25);
}

.module-locked {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

.module-icon {
    width: 52px;
    height: 52px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.4rem;
}

.module-icon-pos    { background: rgba(62,207,207,0.15);  color: var(--clr-secondary); border: 1px solid rgba(62,207,207,0.3);  }
.module-icon-caja   { background: rgba(67,233,123,0.12);  color: #43e97b;              border: 1px solid rgba(67,233,123,0.3);  }
.module-icon-report { background: rgba(108,99,255,0.15); color: var(--clr-primary);   border: 1px solid rgba(108,99,255,0.3); }
.module-icon-inv    { background: rgba(167,139,250,0.15); color: var(--clr-accent);   border: 1px solid rgba(167,139,250,0.3); }
.module-icon-usr    { background: rgba(255,200,100,0.12); color: #ffd580;             border: 1px solid rgba(255,200,100,0.3); }

.module-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--clr-text);
}

.module-desc {
    font-size: 0.82rem;
    color: var(--clr-text-muted);
    line-height: 1.5;
    flex: 1;
}

.module-access {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    align-self: flex-start;
    margin-top: 0.25rem;
}

.module-access.available { background: rgba(67,233,123,0.15); color: #86f3ae; border: 1px solid rgba(67,233,123,0.35); }
.module-access.locked    { background: rgba(255,107,107,0.1);  color: #ff9a9a; border: 1px solid rgba(255,107,107,0.25); }

/* Footer */
.dash-footer {
    text-align: center;
    padding: 1.25rem;
    font-size: 0.75rem;
    color: rgba(160,160,192,0.4);
    border-top: 1px solid var(--clr-border);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 600px) {
    .login-card  { padding: 2rem 1.5rem; }
    .dash-header { padding: 0.85rem 1rem; flex-wrap: wrap; gap: 0.75rem; }
    .dash-main   { padding: 1.5rem 1rem; }
    .dash-welcome-title { font-size: 1.5rem; }
    .dash-modules { grid-template-columns: 1fr 1fr; gap: 1rem; }
}
