@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

main {
    flex: 1;
}

/* Header */
header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    padding: 18px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header-admin-left {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.header-admin-info h1 {
    font-size: 1.65em;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin: 0 0 5px 0;
}

.header-admin-info p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
}

.header-admin-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volver {
    color: white;
    text-decoration: none;
    padding: 10px 22px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.volver:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.volver.logout {
    background: rgba(255,255,255,0.08);
    color: white;
}

/* Mensajes */
.mensaje {
    padding: 18px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mensaje-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 2px solid #10b981;
}

.mensaje-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 2px solid #ef4444;
}

/* Formulario */
.formulario-producto {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 40px;
    transition: box-shadow 0.3s;
}

.formulario-producto:hover {
    box-shadow: 0 15px 40px rgba(0,0,0,0.12), 0 5px 15px rgba(0,0,0,0.08);
}

.formulario-producto h2 {
    margin-bottom: 30px;
    color: #1e293b;
    font-size: 1.8em;
    font-weight: 700;
    border-bottom: 3px solid #C8102E;
    padding-bottom: 15px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s;
    background: #f8fafc;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #C8102E;
    background: white;
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85em;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.btn {
    padding: 14px 30px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #C8102E 0%, #a00d24 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #a00d24 0%, #C8102E 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 16, 46, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    margin-left: 10px;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569 0%, #64748b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 116, 139, 0.4);
}

/* Tabla */
.lista-productos {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
    overflow-x: auto;
}

.lista-productos h2 {
    margin-bottom: 30px;
    color: #1e293b;
    font-size: 1.8em;
    font-weight: 700;
    border-bottom: 3px solid #C8102E;
    padding-bottom: 15px;
}

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

thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
}

th {
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

tbody tr {
    transition: all 0.3s;
}

tbody tr:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.sin-datos {
    text-align: center;
    color: #999;
    padding: 40px;
}

.badge {
    padding: 6px 14px;
    border-radius: 25px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.badge-disponible {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.badge-reservado {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.badge-vendido {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.acciones {
    white-space: nowrap;
}

.select-estado {
    padding: 6px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    margin-right: 8px;
    font-size: 0.9em;
    background: #f8fafc;
    transition: all 0.3s;
    font-weight: 500;
}

.select-estado:focus {
    outline: none;
    border-color: #C8102E;
    background: white;
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

.btn-small {
    padding: 7px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    margin-left: 5px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-edit {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

.btn-edit:hover {
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.btn-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-delete:hover {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Pestañas de navegación */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e5e5e5;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar {
    display: none;
}

.admin-tab {
    padding: 12px 24px;
    text-decoration: none;
    color: #737373;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 400;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.admin-tab.active {
    color: #000000;
    border-bottom-color: #000000;
    font-weight: 600;
}

.admin-tab:hover {
    color: #000000;
}

/* Responsive */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    /* Asegurar que elementos no se desborden */
    img, video, iframe {
        max-width: 100%;
        height: auto;
    }
    
    .container {
        padding: 0 12px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    header {
        padding: 12px 0;
        width: 100%;
        max-width: 100%;
    }
    
    header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        max-width: 100%;
        padding: 0 12px;
    }
    
    .header-admin-left {
        width: 100%;
        max-width: 100%;
    }
    
    .header-admin-info {
        width: 100%;
        max-width: 100%;
    }
    
    .header-admin-info h1 {
        font-size: 1.3em;
        margin-bottom: 8px;
        word-wrap: break-word;
    }
    
    .header-admin-info p {
        font-size: 0.8em;
        line-height: 1.6;
        word-break: break-word;
        max-width: 100%;
    }
    
    .header-admin-info p code {
        font-size: 0.75em;
        padding: 2px 4px;
        word-break: break-all;
        display: inline-block;
        max-width: 100%;
    }
    
    .header-admin-actions {
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
        box-sizing: border-box;
    }
    
    .volver {
        font-size: 0.85em;
        padding: 8px 14px;
        flex: 1;
        min-width: calc(50% - 4px);
        text-align: center;
        justify-content: center;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .notificaciones-icon {
        position: relative;
        order: -1;
    }
    
    #notificaciones-dropdown {
        min-width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        right: 0 !important;
        left: 0 !important;
        margin: 10px auto 0 !important;
        box-sizing: border-box;
    }
    
    /* Pestañas responsive */
    .admin-tabs {
        margin-bottom: 20px;
        gap: 5px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-right: 0;
    }
    
    .admin-tab {
        padding: 10px 14px;
        font-size: 0.85em;
        flex-shrink: 0;
    }
    
    /* Formularios */
    .formulario-producto {
        padding: 20px 12px;
        margin-bottom: 25px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .formulario-producto h2 {
        font-size: 1.4em;
        margin-bottom: 20px;
        word-wrap: break-word;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 18px;
        width: 100%;
    }
    
    .form-group {
        margin-bottom: 18px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 8px;
        word-wrap: break-word;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 12px;
        font-size: 16px; /* Evita zoom en iOS */
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .form-group textarea {
        resize: vertical;
        min-height: 120px;
    }
    
    .form-group small {
        display: block;
        margin-top: 6px;
        word-wrap: break-word;
        font-size: 0.85em;
    }
    
    .btn {
        padding: 14px 24px;
        font-size: 0.95em;
        width: 100%;
        max-width: 100%;
        margin-bottom: 10px;
        box-sizing: border-box;
    }
    
    .btn-secondary {
        margin-left: 0;
        margin-top: 10px;
    }
    
    /* Tablas responsive - convertir a cards */
    .lista-productos {
        padding: 20px 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: visible;
    }
    
    .lista-productos h2 {
        font-size: 1.4em;
        margin-bottom: 20px;
        word-wrap: break-word;
    }
    
    .lista-productos table {
        display: block;
        width: 100%;
        max-width: 100%;
    }
    
    .lista-productos table thead {
        display: none;
    }
    
    .lista-productos table tbody {
        display: block;
        width: 100%;
    }
    
    .lista-productos table tbody tr {
        display: block;
        width: 100%;
        margin-bottom: 15px;
        padding: 15px;
        background: white;
        border: 1px solid #e5e5e5;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        box-sizing: border-box;
    }
    
    .lista-productos table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border: none;
        border-bottom: 1px solid #f5f5f5;
        width: 100%;
        box-sizing: border-box;
    }
    
    .lista-productos table tbody td:last-child {
        border-bottom: none;
    }
    
    .lista-productos table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #737373;
        margin-right: 10px;
        flex-shrink: 0;
    }
    
    .lista-productos table tbody td:first-child::before {
        content: "ID:";
    }
    
    .lista-productos table tbody td:nth-child(2)::before {
        content: "Nombre:";
    }
    
    .lista-productos table tbody td:nth-child(3)::before {
        content: "Precio:";
    }
    
    .lista-productos table tbody td:nth-child(4)::before {
        content: "Estado:";
    }
    
    .lista-productos table tbody td:nth-child(5)::before {
        content: "Acciones:";
    }
    
    .acciones {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        flex: 1;
    }
    
    .select-estado {
        width: 100%;
        margin-bottom: 8px;
        font-size: 16px;
        padding: 10px 12px;
        box-sizing: border-box;
    }
    
    .btn-small {
        padding: 10px 16px;
        font-size: 0.9em;
        width: 100%;
        margin-left: 0;
        text-align: center;
        box-sizing: border-box;
    }
    
    .sin-datos {
        text-align: center;
        padding: 30px 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Mensajes */
    .mensaje {
        padding: 15px;
        font-size: 0.9em;
        margin-bottom: 20px;
    }
    
    .mensaje code {
        font-size: 0.9em;
        padding: 8px 12px;
        word-break: break-all;
        display: block;
        margin-top: 8px;
    }
    
    /* Badges */
    .badge {
        padding: 5px 10px;
        font-size: 0.75em;
        display: inline-block;
    }
    
    /* Vista previa de imágenes */
    #preview-imagenes {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 12px !important;
    }
    
    #preview-imagenes-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
        gap: 10px !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Sección de galería de imágenes */
    .imagen-galeria-item {
        margin-bottom: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .imagen-galeria-item img {
        max-width: 100%;
        height: auto;
        width: 100%;
    }
    
    /* Grid de temas */
    #temas-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .tema-option {
        padding: 12px !important;
    }
    
    .tema-option span[style*="font-size: 2em"] {
        font-size: 1.5em !important;
    }
    
    /* Estadísticas */
    .lista-productos > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .lista-productos > div[style*="grid-template-columns"] > div {
        padding: 20px !important;
    }
    
    .lista-productos > div[style*="grid-template-columns"] > div > div[style*="font-size: 2.5em"] {
        font-size: 2em !important;
    }
    
    /* Información de la tienda */
    .lista-productos > div[style*="background: white"] {
        padding: 20px !important;
    }
    
    .lista-productos > div[style*="background: white"] a {
        font-size: 1em !important;
        word-break: break-all;
    }
    
    /* Tabla de usuarios - misma conversión a cards */
    .lista-productos table tbody td:nth-child(1)::before {
        content: "ID:";
    }
    
    .lista-productos table tbody td:nth-child(2)::before {
        content: "Usuario:";
    }
    
    .lista-productos table tbody td:nth-child(3)::before {
        content: "Nombre:";
    }
    
    .lista-productos table tbody td:nth-child(4)::before {
        content: "Email:";
    }
    
    .lista-productos table tbody td:nth-child(5)::before {
        content: "Tipo:";
    }
    
    .lista-productos table tbody td:nth-child(6)::before {
        content: "Acciones:";
    }
    
    /* Formularios de 2FA */
    .formulario-producto img[alt="QR Code"] {
        max-width: 100%;
        height: auto;
    }
    
    .formulario-producto code {
        font-size: 0.85em;
        word-break: break-all;
        display: block;
        padding: 10px;
        background: #f8fafc;
        border-radius: 6px;
        margin-top: 10px;
    }
    
    /* Botones de acción en formularios */
    .formulario-producto .btn {
        margin-bottom: 10px;
    }
    
    /* Sección de usuarios */
    .lista-productos h2 + table {
        margin-top: 20px;
    }
    
    /* Mejoras generales */
    main.container {
        padding: 0 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    main {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .formulario-producto,
    .lista-productos {
        border-radius: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ajustes para secciones con grid inline */
    section {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    section[style*="margin-top"] {
        margin-top: 25px !important;
    }
    
    /* Ajustes para información de tienda */
    div[style*="background: white"][style*="padding: 30px"] {
        padding: 20px 12px !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Asegurar que elementos específicos respeten el ancho */
    form, fieldset {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Grid de temas mejorado */
    #temas-container {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Grid de estadísticas mejorado */
    div[style*="display: grid"][style*="grid-template-columns"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Ajustes para select de estado en móvil */
    .select-estado {
        font-size: 16px !important; /* Evita zoom en iOS */
    }
    
    /* Mejoras para inputs en móvil */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important; /* Evita zoom en iOS */
    }
}

footer {
    background: #fafafa;
    color: #737373;
    text-align: center;
    padding: 60px 0;
    border-top: 1px solid #e5e5e5;
}

footer p {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 300;
}

