/* Estilos personalizados para Ropero Parroquial */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Sidebar */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar .logo {
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.sidebar .logo h4 {
    margin: 0;
    font-weight: bold;
}

.sidebar .logo p {
    margin: 5px 0 0 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 25px;
    margin: 5px 15px;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

.sidebar .nav-link i {
    margin-right: 10px;
    width: 20px;
}

/* Contenido principal */
.main-content {
    margin-left: 250px;
    padding: 30px;
}

/* Cards */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.stat-card .card-body {
    padding: 25px;
}

.stat-card h3 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: bold;
}

.stat-card p {
    margin: 10px 0 0 0;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Alertas de carta */
.alerta-urgente {
    border-left: 4px solid var(--danger-color);
    background-color: #fee;
}

.alerta-proxima {
    border-left: 4px solid var(--warning-color);
    background-color: #fff8e1;
}

/* Tablas */
.table-custom {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.table-custom thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.table-custom thead th {
    border: none;
    padding: 15px;
    font-weight: 600;
}

.table-custom tbody td {
    padding: 12px 15px;
    vertical-align: middle;
}

/* Badges */
.badge-carta-ok {
    background-color: var(--success-color);
}

.badge-carta-alerta {
    background-color: var(--warning-color);
}

.badge-carta-caducada {
    background-color: var(--danger-color);
}

/* Formularios */
.form-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.form-section h5 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

/* Botones */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f91 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Header de página */
.page-header {
    background: white;
    padding: 25px 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h2 {
    margin: 0;
    color: var(--primary-color);
}

/* Tabla de entregas */
.tabla-entregas {
    width: 100%;
}

.tabla-entregas th {
    background-color: #f8f9fa;
    padding: 10px;
    text-align: left;
}

.tabla-entregas td {
    padding: 10px;
}

.tabla-entregas input[type="number"] {
    width: 80px;
    text-align: center;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.login-body {
    padding: 40px;
}

/* Historial de entregas */
.historial-item {
    border-left: 3px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
}

.historial-fecha {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        z-index: 1000;
        transition: left 0.3s;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat-card {
        margin-bottom: 15px;
    }
}

/* Icono de menú móvil */
.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 999;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
}

/* Utilidades */
.text-primary-custom {
    color: var(--primary-color) !important;
}

.bg-primary-custom {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* Preview de imagen */
.image-preview {
    max-width: 100%;
    max-height: 300px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-top: 10px;
}
/* Tablets y móviles grandes */
@media (max-width: 768px) {
    /* Sidebar responsive */
    .sidebar {
        transform: translateX(-100%);
        z-index: 1050;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    
    /* Tablas responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 100%;
        font-size: 0.9rem;
    }
    
    /* Formularios responsive */
    .form-section {
        padding: 15px;
    }
    
    .row > div {
        margin-bottom: 10px;
    }
    
    /* Botones en móvil */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
    
    .page-header > div {
        width: 100%;
        display: flex;
        gap: 5px;
    }
    
    .page-header .btn {
        flex: 1;
        font-size: 0.85rem;
    }
    
    /* Cards en móvil */
    .card {
        margin-bottom: 15px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    /* Stats cards */
    .stat-card h3 {
        font-size: 1.8rem;
    }
    
    .stat-card p {
        font-size: 0.9rem;
    }
}

/* Móviles pequeños */
@media (max-width: 576px) {
    body {
        font-size: 14px;
    }
    
    h1, h2 {
        font-size: 1.5rem;
    }
    
    h3, h4, h5 {
        font-size: 1.2rem;
    }
    
    /* Tablas en móvil pequeño - modo cards */
    .tabla-entregas tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 10px;
    }
    
    .tabla-entregas tbody td {
        display: block;
        text-align: left !important;
        padding: 5px !important;
        border: none;
    }
    
    .tabla-entregas tbody td:first-child {
        font-weight: bold;
        color: #0d6efd;
    }
    
    /* Inputs más grandes en móvil */
    .form-control,
    .form-select {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 10px;
    }
    
    /* Canvas firma más pequeño */
    #firma-canvas,
    #firma-canvas-modal {
        max-width: 100%;
        height: 150px;
    }
    
    /* Modales en móvil */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-body {
        padding: 15px;
    }
}

/* Landscape mode en móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .main-content {
        padding: 10px;
    }
    
    .card {
        margin-bottom: 10px;
    }
    
    .form-section {
        padding: 10px;
    }
}

/* Fixes específicos para edición */
@media (max-width: 768px) {
    /* Tabla unidad familiar responsive */
    .tabla-unidad-familiar input {
        width: 60px;
        font-size: 14px;
    }
    
    /* Carta derivación en móvil */
    .carta-actual {
        padding: 10px;
    }
    
    .carta-actual .d-flex {
        flex-direction: column !important;
        gap: 10px;
    }
    
    /* Archivo items en móvil */
    .archivo-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 12px;
    }
    
    .archivo-item > div:last-child {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        gap: 5px;
        margin-top: 10px;
    }
}

/* Touch targets más grandes */
@media (max-width: 768px) {
    button,
    .btn,
    a.btn {
        min-height: 44px; /* Mínimo recomendado por Apple */
        padding: 10px 15px;
    }
    
    .btn-sm {
        min-height: 38px;
        padding: 8px 12px;
    }
    
    /* Checkboxes y radios más grandes */
    .form-check-input {
        width: 1.5em;
        height: 1.5em;
    }
    
    .form-check-label {
        padding-left: 0.5em;
    }
}