/* ============================================
   bitacora.css - Bitácora Personal de Actividades
   ============================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
    background: #f0f2f8;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
}

/* ── HEADER ─────────────────────────────────────────────────────────────────── */
.site-header {
    background: linear-gradient(135deg, #2c3e7a 0%, #4a6fa5 60%, #667eea 100%);
    color: white;
    padding: 0;
    box-shadow: 0 4px 20px rgba(44, 62, 122, 0.4);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

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

.header-title .fas {
    font-size: 32px;
    opacity: 0.9;
}

.header-title h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.header-title span {
    font-size: 13px;
    opacity: 0.75;
    display: block;
    margin-top: 2px;
}

.header-fecha {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
}

.header-fecha .fas {
    margin-right: 6px;
}

/* ── MAIN CONTAINER ─────────────────────────────────────────────────────────── */
.main-content {
    padding-top: 24px;
    padding-bottom: 40px;
    max-width: 1200px;
}

/* ── ALERTAS ────────────────────────────────────────────────────────────────── */
.alerta {
    padding: 13px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
    animation: fadeIn .3s ease;
}
.alerta-ok  { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.alerta-err { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }
@keyframes fadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }

/* ── STATS ──────────────────────────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform .2s ease;
}

.stat-card:hover { transform: translateY(-3px); }

.stat-num {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.stat-label .fas { margin-right: 4px; }

.stat-total { border-top: 4px solid #667eea; }
.stat-total .stat-num { color: #667eea; }

.stat-hoy { border-top: 4px solid #17a2b8; }
.stat-hoy .stat-num { color: #17a2b8; }

.stat-pend { border-top: 4px solid #ffc107; }
.stat-pend .stat-num { color: #e0a800; }

.stat-done { border-top: 4px solid #28a745; }
.stat-done .stat-num { color: #28a745; }

/* ── ACCIONES BAR ───────────────────────────────────────────────────────────── */
.acciones-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 22px !important;
    font-weight: 600 !important;
    transition: all .25s ease !important;
}
.btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.45) !important;
}

/* ── FILTROS ────────────────────────────────────────────────────────────────── */
.filtros-card {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-left: 4px solid #17a2b8;
}

.filtros-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filtro-grupo { flex: 1; min-width: 160px; }
.filtro-grupo .form-control { width: 100%; }

.form-control {
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    height: 40px !important;
    font-size: 13px !important;
    transition: border-color .2s ease !important;
}
.form-control:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12) !important;
    outline: none !important;
}
textarea.form-control { height: auto !important; resize: vertical !important; }

.btn-filtrar {
    background: linear-gradient(135deg, #17a2b8, #138496) !important;
    border: none !important;
    border-radius: 8px !important;
    color: white !important;
    padding: 10px 18px !important;
    font-weight: 600 !important;
}
.btn-info { background: linear-gradient(135deg,#17a2b8,#138496)!important; border:none!important; }

/* ── GRID DE ACTIVIDADES ────────────────────────────────────────────────────── */
.actividades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
}

/* ── TARJETA DE ACTIVIDAD ───────────────────────────────────────────────────── */
.act-card {
    background: white;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border-left: 4px solid #667eea;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.act-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.act-done {
    border-left-color: #28a745;
    opacity: 0.82;
}

.act-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
}

.act-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.act-fecha {
    font-size: 11px;
    color: #6c757d;
    font-weight: 500;
}
.act-fecha .fas { margin-right: 3px; }

.act-cat {
    font-size: 11px;
    background: linear-gradient(135deg, #667eea22, #764ba222);
    color: #4a5568;
    padding: 2px 10px;
    border-radius: 50px;
    font-weight: 600;
    border: 1px solid #667eea44;
}

.badge-done {
    font-size: 11px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pend {
    font-size: 11px;
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 600;
    white-space: nowrap;
}

.act-titulo {
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.3;
}

.act-done .act-titulo {
    text-decoration: line-through;
    color: #6c757d;
}

.act-desc {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.5;
}

.act-obs {
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 8px 12px;
    border-left: 3px solid #17a2b8;
    font-style: italic;
}
.act-obs .fas { margin-right: 4px; color: #17a2b8; }

.act-firma-tag {
    font-size: 11px;
    color: #28a745;
    font-weight: 600;
}
.act-firma-tag .fas { margin-right: 4px; }

.act-acciones {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.btn-ver, .btn-ok, .btn-reabrir, .btn-del {
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all .2s ease;
}

.btn-ver     { background: #e8f0fe; color: #4a6fa5; }
.btn-ver:hover { background: #667eea; color: white; }

.btn-ok      { background: #d4edda; color: #155724; }
.btn-ok:hover { background: #28a745; color: white; }

.btn-reabrir { background: #fff3cd; color: #856404; }
.btn-reabrir:hover { background: #ffc107; color: white; }

.btn-del     { background: #f8d7da; color: #721c24; margin-left: auto; }
.btn-del:hover { background: #dc3545; color: white; }

/* ── EMPTY STATE ────────────────────────────────────────────────────────────── */
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}
.empty-state .fas {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
    display: block;
}
.empty-state p { font-size: 16px; margin-bottom: 20px; }

/* ── MODAL ──────────────────────────────────────────────────────────────────── */
.modal-content {
    border: none !important;
    border-radius: 12px !important;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #2c3e7a, #667eea) !important;
    color: white !important;
    border: none !important;
    padding: 16px 22px !important;
}

.modal-header .close {
    color: white !important;
    opacity: 0.8 !important;
    text-shadow: none !important;
    font-size: 22px !important;
}
.modal-header .close:hover { opacity: 1 !important; }

.modal-title { font-weight: 600 !important; }
.modal-title .fas { margin-right: 8px; }

.modal-body { padding: 24px 26px !important; }
.modal-footer { border-top: 1px solid #e9ecef !important; padding: 14px 22px !important; }

.form-group {
    margin-bottom: 18px;
}
.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
    display: block;
}
.form-group label .fas { margin-right: 5px; color: #667eea; }

/* ── FIRMA DIGITAL MEJORADA ──────────────────────────────────────────────────── */
/* Aviso de orientación */
#aviso-rotar {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 13px;
    color: #856404;
    animation: fadeIn .3s ease;
}

#aviso-rotar i {
    margin-right: 8px;
    font-size: 16px;
}

/* Contenedor de firma mejorado */
.signature-container {
    border: 2px dashed #667eea;
    border-radius: 12px;
    padding: 16px;
    background: #f8fafc;
    transition: all .3s ease;
}

.signature-container:focus-within {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.signature-pad-container {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 12px;
    touch-action: none;
    overflow: hidden;
    transition: border-color .2s ease;
}

.signature-pad-container:focus-within {
    border-color: #667eea;
}

.signature-canvas {
    width: 100%;
    height: 200px;
    display: block;
    cursor: crosshair;
    touch-action: none;
    background: white;
}

.signature-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.sig-btn {
    border-radius: 25px;
    padding: 8px 22px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s ease;
}

.sig-clear {
    background: #f8f9fa;
    border: 1px solid #dc3545;
    color: #dc3545;
}

.sig-clear:hover {
    background: #dc3545;
    color: white;
    transform: translateY(-2px);
}

.sig-save {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.sig-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.sig-saved {
    background: linear-gradient(135deg, #17a2b8, #138496) !important;
    opacity: 0.9;
}

/* Texto de ayuda */
.text-muted {
    font-size: 11px;
    color: #6c757d;
    display: block;
    text-align: center;
    margin-top: 8px;
}

/* ── DETALLE ────────────────────────────────────────────────────────────────── */
.detalle-item {
    padding: 14px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 14px;
    border-left: 4px solid #667eea;
}

.detalle-label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}
.detalle-label .fas { margin-right: 5px; color: #667eea; }

.detalle-valor {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    word-break: break-word;
    line-height: 1.5;
}

.detalle-firma {
    font-family: 'Brush Script MT', cursive;
    font-size: 22px;
    color: #17a2b8;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .actividades-grid {
        grid-template-columns: 1fr;
    }
    
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .filtros-form {
        flex-direction: column;
    }
    
    .filtro-grupo { 
        min-width: unset; 
        width: 100%; 
    }
    
    .signature-canvas { 
        height: 160px; 
    }
    
    .sig-btn {
        padding: 6px 16px;
        font-size: 12px;
    }
    
    .modal-body {
        padding: 18px !important;
    }
}

@media (max-width: 480px) {
    .stats-row { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px; 
    }
    
    .stat-num { 
        font-size: 28px; 
    }
    
    .header-title h1 { 
        font-size: 18px; 
    }
    
    .signature-canvas { 
        height: 140px; 
    }
    
    .sig-btn {
        padding: 5px 12px;
        font-size: 11px;
    }
}

/* Mejoras para dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
    .signature-canvas {
        cursor: default;
    }
    
    .sig-btn {
        padding: 10px 20px;
    }
    
    .btn-ver, .btn-ok, .btn-reabrir, .btn-del {
        padding: 8px 16px;
    }
}

/* Animaciones adicionales */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.sig-saved {
    animation: pulse 0.3s ease;
}
/* ── ESTILO PARA SELECT DE CATEGORÍAS ───────────────────────────────────────── */
.categoria-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}

.categoria-select option {
    padding: 10px;
    font-size: 13px;
}

/* Mejora visual para el select en móviles */
@media (max-width: 768px) {
    .categoria-select {
        font-size: 16px !important;
        height: 45px !important;
    }
}
/* ── ESTILO PARA BOTÓN EDITAR ───────────────────────────────────────────────── */
.btn-editar {
    background:#ffc107;
    color: white;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all .2s ease;
}

.btn-editar:hover {
    transform: translateY(-2px);
    background: #e67e22;
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
}