/* ============================================
   Portal del Trabajador - Main Stylesheet
   ============================================ */

:root {
    --portal-primary: #1e72f0;
    --portal-primary-hover: #1560d4;
    --portal-primary-light: #e8f0fe;
    --portal-secondary: #6bd0ff;
    --portal-success: #22c55e;
    --portal-success-light: #dcfce7;
    --portal-danger: #ef4444;
    --portal-danger-light: #fee2e2;
    --portal-warning: #f59e0b;
    --portal-warning-light: #fef3c7;
    --portal-info: #3b82f6;

    --portal-text: #1d1d1f;
    --portal-text-secondary: #6e6e73;
    --portal-text-muted: #aeaeb2;

    --portal-bg: #f5f5f7;
    --portal-card-bg: #ffffff;

    --portal-sidebar-width: 260px;
    --portal-sidebar-bg: #1d1d1f;
    --portal-sidebar-text: rgba(255, 255, 255, 0.7);
    --portal-sidebar-text-active: #ffffff;
    --portal-sidebar-hover: rgba(255, 255, 255, 0.08);
    --portal-sidebar-active: rgba(30, 114, 240, 0.2);

    --portal-topbar-height: 64px;
    --portal-radius: 12px;
    --portal-radius-sm: 8px;
    --portal-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --portal-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --portal-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --portal-transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.portal-body {
    font-family: var(--portal-font);
    background: var(--portal-bg);
    color: var(--portal-text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   Sidebar
   ============================================ */

.portal-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--portal-sidebar-width);
    height: 100vh;
    background: var(--portal-sidebar-bg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
}

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

.sidebar-close {
    background: none;
    border: none;
    color: var(--portal-sidebar-text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
}

.sidebar-user {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--portal-sidebar-text);
    font-size: 1rem;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-local {
    color: var(--portal-sidebar-text);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 4px 12px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--portal-radius-sm);
    color: var(--portal-sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--portal-transition);
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: var(--portal-sidebar-hover);
    color: var(--portal-sidebar-text-active);
}

.sidebar-link.active {
    background: var(--portal-sidebar-active);
    color: var(--portal-sidebar-text-active);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

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

/* ============================================
   Main Content
   ============================================ */

.portal-main {
    margin-left: var(--portal-sidebar-width);
    min-height: 100vh;
}

.portal-topbar {
    height: var(--portal-topbar-height);
    background: var(--portal-card-bg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--portal-text);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--portal-radius-sm);
}

.topbar-toggle:hover {
    background: var(--portal-bg);
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-date {
    color: var(--portal-text-secondary);
    font-size: 0.85rem;
}

.portal-content {
    padding: 24px;
    max-width: 1200px;
}

/* ============================================
   Sidebar Overlay (mobile)
   ============================================ */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   Login Page
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d1d1f 0%, #2d2d30 100%);
    padding: 20px;
}

.login-card {
    background: var(--portal-card-bg);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 60px;
    height: 60px;
    background: var(--portal-primary-light);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
    color: var(--portal-primary);
}

.login-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--portal-text-secondary);
    font-size: 0.9rem;
}

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

.login-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--portal-text);
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--portal-text-muted);
    font-size: 0.9rem;
}

.input-icon input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1.5px solid #e5e5e5;
    border-radius: var(--portal-radius-sm);
    font-size: 0.95rem;
    font-family: var(--portal-font);
    transition: border-color var(--portal-transition);
    outline: none;
}

.input-icon input:focus {
    border-color: var(--portal-primary);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--portal-primary);
    color: #fff;
    border: none;
    border-radius: var(--portal-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--portal-font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background var(--portal-transition);
}

.btn-login:hover {
    background: var(--portal-primary-hover);
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--portal-text-muted);
    font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e5e5;
}

.login-divider span {
    padding: 0 12px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--portal-text-muted);
    font-size: 0.8rem;
}

.login-form .alert {
    font-size: 0.85rem;
    border-radius: var(--portal-radius-sm);
    margin-bottom: 20px;
}

/* Local selector */
.local-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.local-option {
    cursor: pointer;
}

.local-option input[type="radio"] {
    display: none;
}

.local-option-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1.5px solid #e5e5e5;
    border-radius: var(--portal-radius-sm);
    transition: all var(--portal-transition);
}

.local-option-content i {
    font-size: 1.2rem;
    color: var(--portal-text-muted);
    width: 24px;
    text-align: center;
}

.local-option-content div {
    display: flex;
    flex-direction: column;
}

.local-option-content strong {
    font-size: 0.9rem;
}

.local-option-content small {
    color: var(--portal-text-secondary);
    font-size: 0.8rem;
}

.local-option input:checked + .local-option-content {
    border-color: var(--portal-primary);
    background: var(--portal-primary-light);
}

.local-option input:checked + .local-option-content i {
    color: var(--portal-primary);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 991.98px) {
    .portal-sidebar {
        transform: translateX(-100%);
    }

    .portal-sidebar.open {
        transform: translateX(0);
    }

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

    .portal-content {
        padding: 16px;
    }
}

@media (max-width: 575.98px) {
    .login-card {
        padding: 28px 20px;
    }

    .portal-content {
        padding: 12px;
    }
}
