/* Estilos generales para móvil */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding-bottom: 50px;
}

.container {
    max-width: 100%;
    padding: 10px;
}

/* Header */
header {
    background: linear-gradient(135deg, #dc2626 0%, #7f1d1d 100%);
    color: white;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

nav {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    transition: background 0.3s;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.stat-card .number {
    font-size: 1.8rem;
    font-weight: bold;
    color: #dc2626;
}

/* Tablas */
.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin: 15px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #eee;
}

td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

tr:last-child td {
    border-bottom: none;
}

/* Estados */
.estado-activo {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    background: #10b981;
    color: white;
    font-size: 0.85rem;
}

.estado-vencido {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    background: #ef4444;
    color: white;
    font-size: 0.85rem;
}

.estado-proximo {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    background: #f59e0b;
    color: white;
    font-size: 0.85rem;
}

/* Formularios */
.form-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

input,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus,
select:focus {
    outline: none;
    border-color: #dc2626;
}

.btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
}

.btn:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: #6b7280;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Alertas */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Responsive */
@media (min-width: 768px) {
    .container {
        max-width: 750px;
        margin: 0 auto;
    }

    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .btn {
        width: auto;
        padding: 12px 30px;
    }
}

/* Mejoras para móvil */
@media (max-width: 480px) {
    nav {
        flex-wrap: wrap;
        gap: 5px;
    }

    nav a {
        flex: 1 0 calc(50% - 10px);
        font-size: 0.8rem;
        padding: 8px 5px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card .number {
        font-size: 1.5rem;
    }

    /* Botones más grandes para dedos */
    .btn {
        min-height: 44px;
        font-size: 16px;
        /* Previene zoom en iOS */
    }

    input,
    select {
        font-size: 16px;
        /* Previene zoom en iOS */
        min-height: 44px;
    }

    /* Tablas responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;

    }

    table {
        min-width: 600px;
    }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .stat-card,
    .form-container,
    .table-container {
        background: #2d2d2d;
        color: #e0e0e0;
    }

    input,
    select {
        background: #3d3d3d;
        color: #e0e0e0;
        border-color: #555;
    }

    table {
        color: #e0e0e0;
    }

    th {
        background: #3d3d3d;
        color: #e0e0e0;
    }

    tr {
        border-bottom-color: #444;
    }
}

.table-container table td {
    word-wrap: break-word;
    white-space: normal;
    /* Permite que el texto haga wrap */
    max-width: 150px;
    /* Evita que una celda se estire demasiado */
}

/* ===== CONTRATO DE RESPONSABILIDAD (REDISEÑADO) ===== */
.contrato-card {
    background: #1e1e1e;
    /* Fondo oscuro elegante */
    border-left: 6px solid #dc2626;
    /* Borde rojo intenso */
    border-radius: 12px;
    padding: 20px 25px;
    margin: 30px 0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    color: #f0f0f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contrato-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(220, 38, 38, 0.2);
}

.contrato-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 12px;
}

.contrato-header i {
    font-size: 2rem;
    color: #d4af37;
    /* Dorado */
    background: rgba(212, 175, 55, 0.1);
    padding: 10px;
    border-radius: 50%;
}

.contrato-header h4 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contrato-body p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #ccc;
    margin-bottom: 20px;
}

/* Checkbox personalizado */
.contrato-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
    position: relative;
    padding-left: 35px;
}

.contrato-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 24px;
    width: 24px;
    background-color: #333;
    border-radius: 6px;
    transition: all 0.2s;
    border: 2px solid #555;
}

.contrato-checkbox:hover input~.checkmark {
    background-color: #444;
    border-color: #d4af37;
}

.contrato-checkbox input:checked~.checkmark {
    background-color: #dc2626;
    border-color: #dc2626;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.contrato-checkbox input:checked~.checkmark:after {
    display: block;
}

.contrato-checkbox .checkmark:after {
    left: 8px;
    top: 3px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.contrato-checkbox strong {
    color: #fff;
    font-weight: 600;
    margin-left: 5px;
}

/* Hint para campos */
.form-hint {
    display: block;
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 4px;
}