* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* Degradado corporativo usando el Azul Petróleo de Identidad */
    background: linear-gradient(135deg, #325C6A 0%, #1B4D54 100%);
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.container {
    position: relative;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    padding: 30px;
}

/* Header */
.main-header {
    text-align: center;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 30px;
}

.main-header h1 {
    color: #325C6A;
    font-size: 2rem;
    margin-bottom: 10px;
}

.main-header h2 {
    color: #325C6A;
    margin-bottom: 10px;
}

.main-header p {
    color: #666;
}

/* Navegación */
.main-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.nav-card {
    /* Fondo con el Azul de Identidad de Suministros RC16 */
    background: #325C6A;
    padding: 25px;
    border-radius: 12px;
    text-decoration: none;
    color: white;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
    display: block;
}

.nav-card:hover {
    background: #254650;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.nav-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.nav-card h3 {
    margin-bottom: 8px;
    font-size: 1.25rem;
}

.nav-card p {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Tarjetas de estadísticas */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.stat-card h4 {
    font-size: 2rem;
    color: #325C6A;
    margin-bottom: 5px;
}

.stat-card p {
    color: #666;
    font-size: 0.9rem;
}

/* Formularios y Tarjetas */
.card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.card h2 {
    margin-bottom: 20px;
    color: #325C6A;
    font-size: 1.5rem;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.grid-form3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0px 20px;
}

fieldset {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

legend {
    padding: 0 10px;
    font-weight: bold;
    color: #325C6A;
}

.full-width {
    grid-column: span 3;
}

.sgo-4 {
    display: grid;
    grid-template-columns: repeat(3, 1fr) 0.5fr;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
    justify-items: center;
    text-align: center;
    height: 95px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

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

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

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

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group .form-control,
.input-group input {
    padding-right: 45px; /* Espacio para el ojo de contraseña */
}

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.75rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
    resize: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #325C6A;
    box-shadow: 0 0 0 3px rgba(50, 92, 106, 0.15);
}

/* Mostrar/Ocultar Contraseña Toggle */
.toggle-password-icon {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-size: 1.1rem;
    color: #666666;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    z-index: 2;
}

.toggle-password-icon:hover {
    color: #325C6A;
}

.toggle-password-icon.active {
    color: #CF363B; /* Cambia a Rojo cuando el campo está en tipo texto */
}

/* Botones Principales */
.btn {
    /* Botón principal usando el Rojo de Identidad corporativo */
    background: #CF363B;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    width: 100%;
    font-weight: bold;
}

.btn:disabled {
    background: #E0E0E0;
    color: #999999;
    cursor: not-allowed;
    transform: none;
}

.btn:hover:not(:disabled) {
    background: #B22D32; /* Variante hover más oscura */
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(207, 54, 59, 0.3);
}

.btn-small {
    background: #325C6A;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.75rem;
    display: inline-block;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-small:hover {
    background: #254650;
}

/* Tablas */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #325C6A;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Estados */
.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-En-agencia-de-origen {
    background-color: #e0e0e0;
    color: #333333;
}

.status-Tránsito {
    background-color: #f1c40f;
    color: #000000;
}

.status-En-agencia-de-destino {
    background-color: #325C6A; /* Azul corporativo */
    color: white;
}

.status-Entregada {
    background-color: #2ecc71;
    color: white;
}

.status-Cancelada {
    background-color: #CF363B; /* Rojo corporativo */
    color: white;
}

/* Alertas */
.alert {
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #CF363B;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #325C6A;
}

/* QR Container */
.qr-container {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.qr-container img {
    max-width: 250px;
    height: auto;
    margin: 15px 0;
}

/* Lector QR */
#qr-reader {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .grid-form {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: span 1;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .main-nav {
        grid-template-columns: 1fr;
    }

    th,
    td {
        padding: 8px;
        font-size: 0.85rem;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead tr {
        display: none;
    }

    tr {
        border: 1px solid #e0e0e0;
        margin-bottom: 10px;
        border-radius: 5px;
    }

    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #e0e0e0;
        padding: 8px 12px;
    }

    td:before {
        content: attr(data-label);
        font-weight: bold;
        color: #325C6A;
    }
}

/* Loading */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    color: #666;
}

/* BOTONES DE ESTATUS MÓVIL */
.btn-movil {
    width: 100%;
    padding: 20px;
    margin: 10px 0;
    font-size: 1.2rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    color: white;
    font-weight: bold;
    background-color: #325C6A;
    transition: background-color 0.2s;
}

.btn-movil:hover {
    background-color: #254650;
}