/* cliente/css/styles.css */
/* ============================================================ */
/* iOS NATIVE STYLES - PANEL CLIENTE COMUTECH                   */
/* ============================================================ */

:root {
    --ios-bg: #f2f2f6;
    --ios-card: #ffffff;
    --ios-blue: #007aff;
    --ios-green: #34c759;
    --ios-red: #ff3b30;
    --ios-orange: #ff9500;
    --ios-gray: #8e8e93;
    --ios-gray-light: #e5e5ea;
    --ios-border: #c6c6c8;
    --ios-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --ios-shadow-heavy: 0 4px 16px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', system-ui, sans-serif;
    background: var(--ios-bg);
    color: #1c1c1e;
    line-height: 1.4;
    padding-bottom: 70px;
}

/* ============================================================ */
/* LOGIN PANEL                                                 */
/* ============================================================ */

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

.login-card {
    background: var(--ios-card);
    border-radius: 44px;
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--ios-shadow-heavy);
    text-align: center;
}

.login-card .logo {
    font-size: 48px;
    margin-bottom: 16px;
}

.login-card h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1c1c1e;
}

.login-card p {
    color: var(--ios-gray);
    margin-bottom: 24px;
    font-size: 14px;
}

.login-card input {
    width: 100%;
    padding: 16px;
    background: var(--ios-bg);
    border: none;
    border-radius: 14px;
    margin-bottom: 16px;
    font-size: 17px;
    text-align: center;
    letter-spacing: 2px;
}

.login-card input:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 0 4px rgba(0,122,255,0.1);
}

.login-card button {
    width: 100%;
    padding: 16px;
    background: var(--ios-blue);
    color: white;
    border: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 17px;
    cursor: pointer;
}

.error-msg {
    color: var(--ios-red);
    font-size: 14px;
    margin-top: 12px;
    text-align: center;
}

/* ============================================================ */
/* HEADER - DASHBOARD                                          */
/* ============================================================ */

.dashboard-header {
    background: linear-gradient(135deg, #1e4663 0%, #2c7a4d 100%);
    color: white;
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.dashboard-header h1 {
    font-size: 18px;
    margin-bottom: 8px;
    text-align: center;
}

.header-cliente {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    padding: 6px 16px;
    border-radius: 30px;
    border: none;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

/* ============================================================ */
/* TAB BAR (inferior)                                          */
/* ============================================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--ios-border);
    display: flex;
    justify-content: space-around;
    overflow-x: auto;
    padding: 8px 12px 20px;
    gap: 4px;
    z-index: 1000;
}

.bottom-nav::-webkit-scrollbar {
    height: 3px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ios-gray);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    min-width: 70px;
}

.nav-item span:first-child {
    font-size: 22px;
}

.nav-item.active {
    color: #2c7a4d;
    background: #e8f4e8;
}

/* ============================================================ */
/* CONTENEDOR PRINCIPAL                                        */
/* ============================================================ */

.container {
    padding: 16px;
}

/* ============================================================ */
 /* TARJETAS (Tablón, incidencias, histórico)                  */
/* ============================================================ */

.card {
    background: var(--ios-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--ios-shadow);
    border: 0.5px solid var(--ios-border);
}

.card-header {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 0.5px solid var(--ios-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header button {
    font-size: 13px;
    padding: 6px 12px;
}

/* Tarjeta de medición/tarea */
.tarea-card {
    background: var(--ios-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--ios-shadow);
    border: 0.5px solid var(--ios-border);
    border-left-width: 5px;
}

.tarea-card.pendiente { border-left-color: var(--ios-orange); }
.tarea-card.completada { border-left-color: var(--ios-green); }
.tarea-card.resuelta { border-left-color: var(--ios-green); }

.tarea-fecha {
    font-size: 12px;
    color: var(--ios-gray);
    margin-bottom: 8px;
}

.tarea-titulo {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1e4663;
}

.tarea-descripcion {
    font-size: 14px;
    color: #1c1c1e;
    margin-bottom: 12px;
}

.tarea-mediciones {
    background: var(--ios-bg);
    padding: 12px;
    border-radius: 12px;
    margin: 8px 0;
    font-size: 13px;
}

.tarea-comentario {
    background: #f0fdf4;
    padding: 12px;
    border-radius: 12px;
    margin-top: 8px;
    font-size: 13px;
    border-left: 3px solid var(--ios-green);
}

/* ============================================================ */
/* BADGES                                                      */
/* ============================================================ */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-resuelta { background: #d4edda; color: #155724; }
.badge-activo { background: #d4edda; color: #155724; }
.badge-inactivo { background: #f8d7da; color: #721c24; }

/* ============================================================ */
/* BOTONES                                                     */
/* ============================================================ */

.btn-primary {
    background: var(--ios-blue);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
}

.btn-success {
    background: var(--ios-green);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
}

.btn-danger {
    background: var(--ios-red);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
}

.btn-warning {
    background: var(--ios-orange);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
}

.btn-info {
    background: #6b21a5;
    color: white;
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
}

.btn-sm {
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

/* ============================================================ */
/* FORMULARIOS                                                 */
/* ============================================================ */

.row-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.grupo {
    flex: 1;
    min-width: 180px;
}

label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ios-gray);
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
}

input, select, textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--ios-border);
    font-size: 16px;
    transition: all 0.2s;
    background: var(--ios-card);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #1e4663;
    box-shadow: 0 0 0 3px rgba(30, 70, 99, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ============================================================ */
/* TABLAS                                                      */
/* ============================================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--ios-border);
}

.data-table th {
    background: var(--ios-bg);
    font-weight: 600;
    color: #1e4663;
    font-size: 12px;
    text-transform: uppercase;
}

.data-table tr:hover {
    background: var(--ios-bg);
}

/* ============================================================ */
/* MODALES                                                     */
/* ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--ios-card);
    border-radius: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
}

.modal-content h3 {
    margin-bottom: 16px;
    color: #1e4663;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
}

.btn-aceptar { background: #2c7a4d; color: white; border: none; }
.btn-cancelar { background: var(--ios-gray); color: white; border: none; }

/* ============================================================ */
/* MENSAJES FLOTANTES                                          */
/* ============================================================ */

.mensaje {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c7a4d;
    color: white;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    z-index: 3000;
    text-align: center;
    white-space: nowrap;
    animation: fadeOut 2s ease forwards;
    box-shadow: var(--ios-shadow-heavy);
}

.mensaje.error {
    background: var(--ios-red);
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

/* ============================================================ */
/* SPINNER Y UTILITIES                                         */
/* ============================================================ */

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--ios-gray-light);
    border-top-color: var(--ios-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

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

/* ============================================================ */
/* RESPONSIVE                                                  */
/* ============================================================ */

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .row-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .grupo {
        min-width: 100%;
    }
    
    .bottom-nav {
        justify-content: flex-start;
    }
    
    .mensaje {
        white-space: normal;
        text-align: center;
        max-width: 90%;
    }
}