/* ==========================================================================
   ESTILOS HORA HOMBRE - CONTROL DE ASISTENCIA Y TERRENO
   Capataz: Galo Casco | Desarrollado por: Ing. Adelvis Ramírez
   ========================================================================== */

:root {
    --primary-color: #002B49;     /* Azul Sacyr/JBA */
    --secondary-color: #0080FF;   /* Azul Acento */
    --accent-orange: #f39c12;     /* Naranja Casco Capataz */
    --accent-green: #28a745;      /* Verde Presente / Éxito */
    --accent-red: #dc3545;        /* Rojo Ausente */
    --bg-light: #f4f6f9;
    --card-bg: #ffffff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --radius-main: 12px;
    --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* HEADER APP */
.app-header {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-soft);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    font-size: 32px;
    color: var(--accent-orange);
}

#header-title {
    font-size: 20px;
    font-weight: 700;
}

.header-subtitle {
    font-size: 12px;
    opacity: 0.85;
}

.btn-header-dash {
    background: #28a745;
    color: #ffffff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

/* CONTENEDOR PRINCIPAL */
#app-container {
    max-width: 700px;
    margin: 20px auto;
    padding: 0 16px;
    flex: 1;
    width: 100%;
}

.screen {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-badge {
    background: var(--primary-color);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* TARJETAS DE CONTENIDO */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-main);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header-flex h3 {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 700;
}

/* INPUT GROUPS */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-group input, .input-group textarea, .input-group select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus, .input-group textarea:focus {
    border-color: var(--secondary-color);
}

.row {
    display: flex;
    gap: 12px;
}

.half {
    flex: 1;
}

.sub-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

/* BOX DE HORARIOS */
.schedule-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.schedule-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
}

.hours-summary-card {
    background: linear-gradient(135deg, #002B49 0%, #004080 100%);
    color: #ffffff;
    padding: 14px 18px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hours-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

#horas-calculadas-badge {
    font-size: 20px;
    color: #ffc107;
    font-weight: 700;
}

.hours-text-fmt {
    font-size: 12px;
    opacity: 0.9;
    font-family: monospace;
    background: rgba(255,255,255,0.15);
    padding: 4px 8px;
    border-radius: 4px;
}

/* NÓMINA DE TRABAJADORES */
.btn-add-worker {
    background: #17a2b8;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.workers-counter-bar {
    background: #e9ecef;
    padding: 8px 14px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
}

.badge-count {
    background: var(--primary-color);
    color: #ffffff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 14px;
}

.workers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.worker-item-row {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
    cursor: pointer;
}

.worker-item-row:hover {
    background: #f8fafc;
}

.worker-item-row.selected {
    background: #e8f4ea;
    border-color: var(--accent-green);
}

.worker-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 2px solid #adb5bd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s;
}

.worker-item-row.selected .checkbox-custom {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

/* FOTOS */
.photos-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.photos-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-color);
}

.photos-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 6px;
}

.photo-upload-box {
    position: relative;
    aspect-ratio: 1;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
}

.photo-placeholder i {
    font-size: 24px;
}

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

.btn-remove-photo {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
}

/* BOTONES PRINCIPALES */
.btn-primary, .btn-secondary, .btn-success {
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: #ffffff;
}

.btn-secondary {
    background: #6c757d;
    color: #ffffff;
}

.btn-success {
    background: var(--accent-green);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.3);
}

.btn-group-row {
    display: flex;
    gap: 12px;
}

.btn-group-row button {
    flex: 1;
}

/* MODAL */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-card {
    background: #ffffff;
    border-radius: var(--radius-main);
    width: 100%;
    max-width: 440px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-header {
    background: var(--primary-color);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.modal-close-worker {
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-footer {
    padding: 14px 18px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

/* OVERLAY DE CARGA */
.overlay {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.spinner-box {
    text-align: center;
}

.spinner {
    font-size: 44px;
    color: var(--accent-orange);
    margin-bottom: 12px;
}

/* FIRMA CREDITO AUTORÍA */
.author-credits {
    text-align: center;
    padding: 20px 16px;
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    font-size: 13px;
    color: var(--text-muted);
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #25d366;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 8px;
    font-size: 12px;
}

.hidden {
    display: none !important;
}
