/* custom.css - Conexión Plus Mobile-First Stylesheet */

:root {
    --primary-color: #2c3e50;
    --success-color: #2ecc71;
    --success-bg: #d1e7dd;
    --success-text: #0f5132;
    --danger-color: #e74c3c;
    --danger-bg: #f8d7da;
    --danger-text: #842029;
    --warning-color: #f1c40f;
    --warning-bg: #fff3cd;
    --warning-text: #664d03;
    --bg-light: #f8f9fa;
    --card-shadow: 0 4px 6px rgba(0,0,0,0.1);
    --border-radius: 12px;
}

body {
    background-color: var(--bg-light);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    padding-bottom: 80px; /* Space for the bottom navigation bar */
}

/* Typography scale optimized for legibility (especially older eyes) */
h1, .h1 { font-size: 1.8rem; font-weight: 700; }
h2, .h2 { font-size: 1.5rem; font-weight: 600; }
h3, .h3 { font-size: 1.25rem; font-weight: 600; }
p, .lead { font-size: 1.1rem; }

/* Large Touch Target Cards */
.mobile-card {
    background-color: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 2px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: 15px;
    padding: 18px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-card:active {
    transform: scale(0.98);
}

.mobile-card.selected {
    border-color: var(--success-color);
    background-color: #f0fff4;
}

/* Attendance Checkbox / Indicator matching action circle buttons */
.card-check-indicator {
    width: 32px;
    height: 32px;
    padding: 0;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.card-check-indicator:hover {
    transform: scale(1.08);
}

/* User Profile Image or Initial Placeholder */
.avatar-placeholder {
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: #ffffff;
    font-size: 22px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 15px;
}

.selected .avatar-placeholder {
    background-color: var(--success-color);
}

/* Bottom Navigation Bar for One-Handed Operation (Thumb Zone) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background-color: #ffffff;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1030;
    border-top: 1px solid #dee2e6;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #7f8c8d;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    width: 25%;
    height: 100%;
    transition: color 0.15s ease;
}

.bottom-nav-item i {
    font-size: 22px;
    margin-bottom: 2px;
}

.bottom-nav-item:hover, .bottom-nav-item:active, .bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active i {
    color: var(--primary-color);
}

/* High Contrast Overlay Screens (OCR results) */
.overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: #ffffff;
    animation: fadeIn 0.3s ease;
}

.overlay-screen.success {
    background-color: var(--success-color);
}

.overlay-screen.danger {
    background-color: var(--danger-color);
}

.overlay-icon {
    font-size: 100px;
    margin-bottom: 20px;
}

/* One-Handed Thumb Button Area (Main Action Buttons at the Bottom) */
.sticky-bottom-button-area {
    position: fixed;
    bottom: 80px; /* Sits just above the bottom nav */
    left: 0;
    right: 0;
    padding: 10px 20px;
    background-color: transparent;
    pointer-events: none; /* Let clicks pass through background */
    z-index: 1020;
    display: flex;
    justify-content: center;
}

.sticky-bottom-button-area .btn {
    pointer-events: auto; /* Re-enable clicks on the button itself */
    width: 100%;
    max-width: 400px;
    font-size: 18px;
    font-weight: bold;
    padding: 14px 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* High Contrast Alert Cards */
.alert-contrast {
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1.1rem;
    padding: 15px;
    margin-bottom: 20px;
    border: 2px solid transparent;
}

.alert-contrast-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border-color: #a3cfbb;
}

.alert-contrast-danger {
    background-color: var(--danger-bg);
    color: var(--danger-text);
    border-color: #f1aeb5;
}

.alert-contrast-warning {
    background-color: var(--warning-bg);
    color: var(--warning-text);
    border-color: #ffe69c;
}

/* Camera Preview Styling */
.camera-container {
    width: 100%;
    max-height: 350px;
    background-color: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
    border: 2px solid var(--primary-color);
}

#camera-video {
    width: 100%;
    height: auto;
    display: block;
}

/* Scan Scanner Line Overlay Animation */
.scanner-line {
    position: absolute;
    height: 4px;
    width: 100%;
    background-color: var(--danger-color);
    top: 0;
    left: 0;
    animation: scan 2s linear infinite;
    box-shadow: 0 0 8px var(--danger-color);
    z-index: 10;
}

/* Keyframes */
@keyframes scan {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Login container customization */
.login-container {
    max-width: 420px;
    width: 90%;
    margin: 50px auto;
    padding: 30px;
    background-color: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

/* Custom large input fields for accessibility */
.form-control-lg {
    font-size: 18px;
    padding: 12px 15px;
    border-radius: 8px;
}
.form-label {
    font-weight: 600;
    font-size: 1.05rem;
}

/* Mobile responsive fixes for connector cards and action buttons */
.connector-card {
    min-width: 0;
}
.connector-details {
    min-width: 0;
    overflow: hidden;
}
.connector-actions {
    flex-shrink: 0;
}
@media (max-width: 576px) {
    .connector-card {
        padding: 12px 14px !important;
    }
    .connector-card .avatar-placeholder {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        font-size: 16px !important;
        margin-right: 10px !important;
    }
    .connector-actions {
        gap: 6px !important;
    }
}

/* Modulo D: Graficos y Analitica */
.kpi-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 4px solid #cbd5e1;
    position: relative;
    overflow: hidden;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
.kpi-card.kpi-conectados { border-left-color: #10b981; }
.kpi-card.kpi-amg { border-left-color: #f59e0b; }
.kpi-card.kpi-a1 { border-left-color: #6366f1; }
.kpi-card.kpi-noconectados { border-left-color: #ef4444; }
.kpi-card.kpi-total { border-left-color: #3b82f6; }
.kpi-card.kpi-efectividad { border-left-color: #06b6d4; }

.kpi-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.kpi-conectados .kpi-icon-circle { background-color: #ecfdf5; color: #10b981; }
.kpi-amg .kpi-icon-circle { background-color: #fffbeb; color: #d97706; }
.kpi-a1 .kpi-icon-circle { background-color: #eef2ff; color: #6366f1; }
.kpi-noconectados .kpi-icon-circle { background-color: #fef2f2; color: #ef4444; }
.kpi-total .kpi-icon-circle { background-color: #eff6ff; color: #3b82f6; }
.kpi-efectividad .kpi-icon-circle { background-color: #ecfeff; color: #06b6d4; }

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    color: #1e293b;
}

.chart-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}
.chart-container-box {
    position: relative;
    width: 100%;
    min-height: 280px;
}

.date-pill-btn {
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    transition: all 0.2s ease;
}
.date-pill-btn.active {
    background-color: #ff9f43 !important;
    color: #ffffff !important;
    border-color: #ff9f43 !important;
}

.table-stats th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.table-stats td {
    vertical-align: middle;
    font-size: 14px;
}

/* Submodule Navigation (Tab Selector inspired by Kids Dashboard) */
.submodule-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: #e2e8f0;
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 18px;
}
.submodule-tab-btn {
    border: none;
    background: transparent;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}
.submodule-tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.6);
    color: #1e293b;
}
.submodule-tab-btn.active {
    background: #ffffff;
    color: #4f46e5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
@media (max-width: 768px) {
    .submodule-nav {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .submodule-tab-btn {
        padding: 9px 12px;
        font-size: 13px;
        justify-content: flex-start;
    }
}

/* Kids-style top gradient border on KPI cards */
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}
.kpi-card.kpi-conectados::before {
    background: linear-gradient(90deg, #10b981, #34d399);
}
.kpi-card.kpi-amg::before {
    background: linear-gradient(90deg, #f59e0b, #fcd34d);
}
.kpi-card.kpi-a1::before {
    background: linear-gradient(90deg, #4f46e5, #818cf8);
}
.kpi-card.kpi-noconectados::before {
    background: linear-gradient(90deg, #ef4444, #f87171);
}
.kpi-card.kpi-total::before {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}
.kpi-card.kpi-efectividad::before {
    background: linear-gradient(90deg, #06b6d4, #22d3ee);
}

.overview-period-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.18);
    border-radius: 99px;
    padding: 0.3rem 0.9rem;
    margin-bottom: 0.75rem;
}
