/* ========================================
   ESTILOS BASE
   ======================================== */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* Prevenir overflow horizontal en todos los elementos */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
}

/* Asegurar que ningún contenedor cause scroll horizontal */
.page-content,
.container,
.container-fluid,
main {
    max-width: 100%;
    overflow-x: hidden;
}

a, .btn-link {
    color: #d87000;
}

.btn-primary {
    color: #fff;
    background-color: #ff8c00;
    border-color: #e67e00;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #ffa726;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #ff8c00;
}

.invalid {
    outline: 1px solid #ff6347;
}

.validation-message {
    color: #ff6347;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5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pbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ========================================
   OPTIMIZACIÓN PARA MÓVILES - BOTONES
   ======================================== */
table tbody tr td button.btn-sm,
table tbody tr td button.btn,
.modal-body button.btn-sm,
.sucursal-card button.btn-sm,
.modal-section button.btn-sm {
    font-size: 0;
    padding: 0.25rem 0.5rem;
    min-width: auto;
}

table tbody tr td button.btn-sm span.bi,
table tbody tr td button.btn span.bi,
.modal-body button.btn-sm span.bi,
.sucursal-card button.btn-sm span.bi,
.modal-section button.btn-sm span.bi {
    font-size: 1rem;
    display: inline-block;
}

/* ========================================
   DISEÑO RESPONSIVE PARA MÓVILES
   ======================================== */

/* Tipografía responsive */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
}

/* Page header responsive */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h1 {
        font-size: 1.3rem;
        margin-bottom: 0;
    }
    
    .header-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .header-actions button {
        flex: 1;
        min-width: 120px;
        font-size: 0.85rem;
    }
}

/* Tablas responsive */
@media (max-width: 768px) {
    .table-responsive {
        border: 0;
    }
    
    /* Ocultar encabezados de tabla en móvil */
    table thead {
        display: none;
    }
    
    /* Convertir filas en cards */
    table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        background: white;
    }
    
    table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.75rem !important;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    table tbody td:last-child {
        border-bottom: none;
    }
    
    /* Añadir etiquetas antes de cada celda */
    table tbody td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #ff8c00;
        margin-right: 1rem;
        min-width: 100px;
    }
    
    /* Columna de acciones en móvil */
    table tbody td.action-column,
    table tbody td:last-child {
        justify-content: flex-end;
        gap: 0.5rem;
    }
    
    table tbody td.action-column::before,
    table tbody td:last-child::before {
        content: '';
        display: none;
    }
}

/* Formularios responsive */
@media (max-width: 768px) {
    .form-group,
    .mb-3 {
        margin-bottom: 1rem !important;
    }
    
    .form-control,
    .form-select {
        font-size: 16px; /* Previene zoom en iOS */
        padding: 0.75rem;
    }
    
    label {
        margin-bottom: 0.5rem;
        font-weight: 600;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }
}

/* Cards responsive */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
}

/* Modales responsive */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer button {
        width: 100%;
        margin: 0 !important;
    }
}

/* Contenido principal responsive */
@media (max-width: 768px) {
    .content {
        padding: 1rem 0.75rem !important;
    }
    
    .px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* Inputs y selects táctiles */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        -webkit-appearance: none;
        appearance: none;
        min-height: 44px; /* Tamaño mínimo táctil recomendado */
    }
    
    /* Mejora de botones táctiles */
    .btn {
        min-height: 44px;
        touch-action: manipulation;
    }
}

/* Navegación inferior fija para móviles (opcional) */
@media (max-width: 768px) {
    .mobile-actions-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #ddd;
        padding: 0.75rem;
        display: flex;
        gap: 0.5rem;
        z-index: 900;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .mobile-actions-bar .btn {
        flex: 1;
    }
}

/* Scroll horizontal suave */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Mejoras de accesibilidad táctil */
@media (max-width: 768px) {
    a,
    button,
    .clickable {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Grid responsive */
@media (max-width: 768px) {
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .row > * {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Toast notifications responsive */
@media (max-width: 768px) {
    .toast {
        max-width: calc(100% - 2rem);
        margin: 1rem;
    }
}
