a {
    text-decoration: none !important;
}

label {
    display: block;
    margin-bottom: 8px;
    margin-top: 15px;
    font-size: 1rem;
    color: #333;
    font-weight: bold;
}

#alert {
    color: red;
    text-align: center;
    margin-top: 10px;
    width: fit-content;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea {
    opacity: 1 !important;
    width: 100%;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    display: block;
    background-color: #f1f1f1;
}

/* Efecto al enfocar (focus) */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="file"]:focus,
textarea:focus {
    border-color: #7e998a;
    box-shadow: 0 0 0 3px rgb(133, 135, 124);
    outline: none;
}

/* Estilo para áreas de texto */
textarea {
    resize: vertical;
}

#regreso {
    margin-top: 1%;
    margin-left: 20px;
    font-size: 1rem;
    width: 10%;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
}

button,
a.button {
    display: block;
    width: 25%;
    padding: 12px 20px;
    border: 3px solid #ffaf04;
    color: #333;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.1s;
}

button:hover,
a.button:hover {
    background-color: #ffaf04;
    color: #333;
    transform: translateY(-1px);
}

button:active,
a.button:active {
    transform: translateY(1px);
}

button[type="submit"] {
    display: block;
    width: 100%;
    max-width: 250px;
    padding: 12px 20px;
    margin-top: 30px;
    border: 1px solid #ffaf04;
    color: #333;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.1s;
}

button[type="submit"]:hover {
    background-color: #ffaf04;
    color: #333;
    transform: translateY(-1px);
}

button[type="submit"]:active {
    transform: translateY(1px);
}

select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #f1f1f1;
    background-position: right 10px center;
    background-repeat: no-repeat;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
    display: block;
}

select:focus {
    border-color: #7e998a;
    box-shadow: 0 0 0 3px rgb(133, 135, 124);
    outline: none;
}

select option {
    padding: 10px;
}

.file-label {
    display: inline-block;
    width: 100%;
    background-color: #f0f0f0;
    color: #333;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    border: 1px solid #ccc;
    font-weight: normal;
    transition: background-color 0.3s, border-color 0.3s;
    margin-bottom: 20px;
}

.file-label:hover {
    border-color: #7e998a;
    box-shadow: 0 0 0 3px rgb(133, 135, 124);
}

/* ===== TABLAS RESPONSIVE ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* CORREGIDO: Min-width optimizado para 6 columnas */
.table-responsive table {
    width: 100%;
    min-width: 400px;
    margin: 0;
    border: none;
    border-collapse: collapse;
}

.table-responsive th,
.table-responsive td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-responsive th {
    background-color: #8b8b8b;
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    font-size: 0.85rem;
    padding: 8px 12px;
}

.table-responsive tbody tr:hover {
    background-color: #f8f9fa;
}

/* Scroll personalizado para tablas */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #ffaf04;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #e59d00;
}

/* Estados de pedidos */
.estado {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
    white-space: nowrap;
}

.estado.pendiente {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.estado.entregado {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.estado.proceso {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.estado.cancelado {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Estilos base para tablas regulares */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #f5f5f5;
    border: 3px solid rgb(206, 206, 206);
}

thead {
    color: #fff;
    background-color: #8b8b8b;
    border: 3px solid rgb(206, 206, 206);
}

tbody {
    color: #333;
}

th,
td {
    padding: 15px;
    text-align: left;
    margin: 10px;
    font-family: Arial, Helvetica, sans-serif;
}

#lista-categorias,
#lista-pedidos,
#lista-usuarios,
table {
    width: fit-content;
    margin: 20px auto;
    border-collapse: collapse;
}

#lista-categorias,
#lista-pedidos,
#lista-usuarios,
th,
#lista-categorias,
#lista-pedidos,
#lista-usuarios,
td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
}

#lista-categorias,
#lista-pedidos,
#lista-usuarios,
tbody td:first-child {
    text-align: left;
}

#lista-categorias,
#lista-pedidos,
#lista-usuarios,
tbody td:last-child {
    text-align: center;
}

.edit {
    border: 2px solid #ffaf04;
    color: #333;
    padding: 10px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    width: auto;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
    text-align: center;
}

.edit:hover {
    background-color: #ffaf04;
    color: #333;
    transform: translateY(3px);
}

.view {
    border: 2px solid #0b5e03;
    color: #333;
    padding: 10px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    width: auto;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
    text-align: center;
}

.view:hover {
    background-color: #0b5e03;
    color: #fff;
    transform: translateY(3px);
}

.eli {
    border: 2px solid #C1292E;
    color: #333;
    padding: 10px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    width: auto;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
    text-align: center;
}

.eli:hover {
    background-color: #C1292E;
    color: #fff;
    transform: translateY(3px);
}

.act {
    border: 2px solid #0496ff;
    color: #333;
    padding: 10px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    width: auto;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
    text-align: center;
}

.act:hover {
    background-color: #0496ff;
    color: #333;
    transform: translateY(3px);
}

/* Mejoras para legibilidad en columnas compactas */
.table-responsive td:nth-child(2) { /* Columna Cliente */
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-responsive td:nth-child(3) { /* Columna Dirección */
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tooltip para texto truncado */
.table-responsive td[title] {
    cursor: help;
}

/* Asegurar que los botones en las tablas sean compactos */
.table-responsive .edit,
.table-responsive .eli,
.table-responsive .act {
    padding: 6px 8px;
    font-size: 0.8rem;
    margin: 2px;
    white-space: nowrap;
}

/* ===== MEDIA QUERIES RESPONSIVE ===== */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    button,
    a.button {
        width: 35%;
    }
    
    #regreso {
        width: 15%;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .table-responsive table {
        min-width: 350px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
}

/* Tabletas pequeñas (600px - 767px) */
@media (max-width: 767px) {
    button,
    a.button {
        width: 45%;
    }
    
    #regreso {
        width: 20%;
        margin-left: 10px;
        font-size: 0.9rem;
    }
    
    label {
        font-size: 0.9rem;
        margin-top: 12px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="file"],
    textarea,
    select {
        font-size: 0.9rem;
        padding: 8px;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .table-responsive table {
        min-width: 320px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 8px 8px;
        font-size: 0.8rem;
    }
    
    .table-responsive .edit,
    .table-responsive .eli,
    .table-responsive .act {
        padding: 4px 6px;
        font-size: 0.75rem;
        display: block;
        margin: 1px 0;
        width: 100%;
    }
    
    /* Columnas más compactas en tablets */
    .table-responsive th:nth-child(3),
    .table-responsive td:nth-child(3) {
        max-width: 120px;
    }
    
    .mobile-hidden {
        display: none;
    }
}

/* Móviles grandes (480px - 599px) */
@media (max-width: 599px) {
    button,
    a.button {
        width: 60%;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    #regreso {
        width: 25%;
        font-size: 0.8rem;
        margin-left: 5px;
    }
    
    button[type="submit"] {
        padding: 10px 15px;
        font-size: 1rem;
    }
    
    .edit, .view, .eli, .act {
        padding: 8px;
        font-size: 0.9rem;
        margin: 3px;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    .table-responsive table {
        min-width: 300px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    .table-responsive .edit,
    .table-responsive .eli,
    .table-responsive .act {
        padding: 4px 8px;
        font-size: 0.75rem;
        display: block;
        margin: 2px 0;
        width: 100%;
    }
}

/* Móviles medianos (400px - 479px) */
@media (max-width: 479px) {
    button,
    a.button {
        width: 70%;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    #regreso {
        width: 30%;
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    
    label {
        font-size: 0.9rem;
        margin-top: 10px;
        margin-bottom: 6px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="file"],
    textarea,
    select {
        font-size: 0.9rem;
        padding: 6px;
    }
    
    .file-label {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    #lista-categorias,
    #lista-pedidos,
    #lista-usuarios,
    th,
    #lista-categorias,
    #lista-pedidos,
    #lista-usuarios,
    td {
        padding: 8px 6px;
    }
    
    .table-responsive table {
        min-width: 280px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 5px 6px;
        font-size: 0.7rem;
    }
    
    .table-responsive .edit,
    .table-responsive .eli,
    .table-responsive .act {
        padding: 5px 8px;
        font-size: 0.8rem;
        display: block;
        margin: 2px 0;
        width: 100%;
        text-align: center;
    }
    
    .estado {
        font-size: 0.75rem;
        padding: 3px 6px;
    }
    
    /* Solo mostrar columnas esenciales en móviles muy pequeños */
    .table-responsive th:nth-child(3),
    .table-responsive td:nth-child(3) {
        display: none;
    }
}

/* Móviles pequeños (320px - 399px) */
@media (max-width: 399px) {
    button,
    a.button {
        width: 80%;
        padding: 7px 10px;
        font-size: 0.85rem;
    }
    
    #regreso {
        width: 35%;
        font-size: 0.75rem;
        padding: 6px 8px;
    }
    
    button[type="submit"] {
        padding: 8px 12px;
        font-size: 0.9rem;
        max-width: 200px;
    }
    
    .edit, .view, .eli, .act {
        padding: 6px;
        font-size: 0.85rem;
        margin: 2px;
        display: block;
        width: 100%;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 5px 3px;
    }
    
    #alert {
        font-size: 0.8rem;
    }
    
    .table-responsive {
        margin: 10px 0;
        border-radius: 6px;
    }
    
    .table-responsive table {
        min-width: 260px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 4px 5px;
        font-size: 0.65rem;
    }
    
    .estado {
        font-size: 0.6rem;
        padding: 2px 4px;
    }
}

/* Móviles muy pequeños (240px - 319px) */
@media (max-width: 319px) {
    button,
    a.button {
        width: 90%;
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    #regreso {
        width: 40%;
        font-size: 0.7rem;
        padding: 5px 6px;
    }
    
    label {
        font-size: 0.85rem;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="file"],
    textarea,
    select {
        font-size: 0.85rem;
        padding: 5px;
    }
    
    .file-label {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    table {
        font-size: 0.7rem;
    }
    
    th, td {
        padding: 4px 2px;
    }
    
    .table-responsive table {
        min-width: 240px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 3px 4px;
        font-size: 0.6rem;
    }
}

/* Dispositivos mínimos (200px - 239px) */
@media (max-width: 239px) {
    button,
    a.button {
        width: 95%;
        padding: 5px 6px;
        font-size: 0.75rem;
    }
    
    #regreso {
        width: 45%;
        font-size: 0.65rem;
        padding: 4px 5px;
    }
    
    button[type="submit"] {
        padding: 6px 8px;
        font-size: 0.8rem;
        max-width: 150px;
    }
    
    .edit, .view, .eli, .act {
        padding: 4px;
        font-size: 0.75rem;
        margin: 1px;
    }
    
    table {
        font-size: 0.65rem;
    }
    
    th, td {
        padding: 3px 1px;
    }
    
    .table-responsive table {
        min-width: 220px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 2px 3px;
        font-size: 0.55rem;
    }
}

/* Estilos específicos para tablas en móviles */
@media (max-width: 600px) {
    form {
        margin: 20px 10px;
        padding: 20px;
    }

    .view,
    .edit,
    .eli,
    .act {
        display: block;
        width: 100%;
        margin: 5px 0;
    }

    table {
        width: 100%;
        overflow-x: auto;
        display: block;
    }

    #lista-pedidos table,
    #lista-categorias table,
    #lista-usuarios table {
        width: 100%;
        overflow-x: auto;
        display: block;
    }
}

/* Mejoras de usabilidad táctil para móviles */
@media (max-width: 768px) {
    button,
    a.button,
    .edit,
    .view,
    .eli,
    .act,
    .file-label,
    select {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea {
        min-height: 44px;
    }
}

/* Prevenir zoom en iOS */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px;
    }
}

/* Scroll suave para tablas en móviles */
@media (max-width: 767px) {
    table {
        -webkit-overflow-scrolling: touch;
    }
}