/* Settings Module - Estilos compactos */

/* Variables Tailwind personalizadas */
:root {
    --dark-950: #0a0a0f;
    --dark-900: #111118;
    --dark-800: #1a1a24;
    --dark-700: #252532;
    --accent-400: #818cf8;
    --accent-500: #6366f1;
}

body {
    background: var(--dark-950);
    font-size: 12px;
}

/* Contenedor principal - permite scroll en móvil */
main.p-2 {
    min-height: calc(100vh - 100px);
}

/* En pantallas grandes, permitir scroll */
@media (min-width: 768px) {
    body {
        overflow-y: auto;
    }

    main.p-2 {
        min-height: calc(100vh - 100px);
        overflow: visible;
    }
}

/* Tarjetas de configuración */
.settings-card {
    background: var(--dark-900);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* DJ card ocupa 2 columnas solo en pantallas pequeñas con 2+ columnas */
@media (min-width: 640px) and (max-width: 767px) {
    .settings-card.dj-card {
        grid-column: span 2;
    }
}

/* Header de tarjeta */
.card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--dark-800);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
}

.card-header i {
    font-size: 10px;
    color: var(--accent-400);
    width: 14px;
    text-align: center;
}

/* Body de tarjeta */
.card-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.card-body.empty {
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    gap: 8px;
    min-height: 80px;
}

.card-body.empty i {
    font-size: 20px;
}

.card-body.empty span {
    font-size: 10px;
}

/* Fila de configuración */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
}

.setting-row:hover {
    color: rgba(255,255,255,0.9);
}

/* Toggle switch compacto */
.toggle-switch {
    appearance: none;
    width: 28px;
    height: 14px;
    background: var(--dark-700);
    border-radius: 7px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-switch:checked {
    background: var(--accent-500);
}

.toggle-switch:checked::before {
    left: 16px;
    background: white;
}

/* Select compacto */
.mini-select {
    background: var(--dark-700);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 9px;
    color: white;
    cursor: pointer;
    min-width: 60px;
}

.mini-select:focus {
    outline: none;
    border-color: var(--accent-500);
}

.mini-select option {
    background: var(--dark-800);
}

/* Input numérico compacto */
.mini-input {
    background: var(--dark-700);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 10px;
    color: white;
    width: 55px;
    text-align: center;
}

.mini-input:focus {
    outline: none;
    border-color: var(--accent-500);
}

.mini-input::-webkit-inner-spin-button,
.mini-input::-webkit-outer-spin-button {
    opacity: 1;
    height: 14px;
}

/* Sección dentro de tarjeta DJ */
.setting-section {
    margin-bottom: 8px;
}

.setting-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 9px;
    font-weight: 600;
    color: var(--accent-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Grid de atajos de teclado */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
    max-height: 160px;
    overflow-y: auto;
    padding-right: 4px;
}

.shortcuts-grid::-webkit-scrollbar {
    width: 3px;
}

.shortcuts-grid::-webkit-scrollbar-track {
    background: var(--dark-800);
}

.shortcuts-grid::-webkit-scrollbar-thumb {
    background: var(--dark-700);
    border-radius: 2px;
}

/* Fila de atajo */
.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 4px;
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
    font-size: 9px;
    color: rgba(255,255,255,0.6);
}

.shortcut-row span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}

/* Botón de tecla */
.key-btn {
    min-width: 32px;
    padding: 2px 5px;
    background: var(--dark-700);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    font-size: 8px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Consolas', monospace;
}

.key-btn:hover {
    background: var(--dark-800);
    border-color: var(--accent-500);
    color: white;
}

.key-btn.recording {
    background: var(--accent-500);
    border-color: var(--accent-400);
    color: white;
    animation: pulse-key 0.5s ease infinite;
}

@keyframes pulse-key {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Botón reset */
.btn-reset {
    margin-top: 6px;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    font-size: 9px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-reset:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Modal para capturar tecla */
.key-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.key-modal.hidden {
    display: none;
}

.key-modal-content {
    background: var(--dark-900);
    border: 1px solid var(--accent-500);
    border-radius: 8px;
    padding: 16px 24px;
    text-align: center;
}

.key-modal-title {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
}

.key-modal-current {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-400);
    font-family: 'Consolas', monospace;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key-modal-hint {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    margin-top: 12px;
}

/* Navegación inferior */
nav.fixed.bottom-0 {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    padding: 4px 12px;
    transition: color 0.2s;
}

.nav-item:hover {
    color: rgba(255,255,255,0.8);
}

.nav-item.active {
    color: var(--accent-400);
}

/* Audio output select más ancho */
.audio-output {
    min-width: 80px;
    max-width: 100px;
}


/* Responsive: móvil */
@media (max-width: 640px) {
    .shortcuts-grid {
        grid-template-columns: 1fr;
        max-height: 150px;
    }

    .shortcut-row span {
        max-width: 100px;
    }

    /* Body: usar dvh para evitar problemas con barra de direcciones */
    body {
        height: 100dvh;
        min-height: -webkit-fill-available;
    }

    /* Navegación inferior con safe-area */
    nav.fixed.bottom-0 {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Agregar padding al contenido para no tapar con la nav fija */
    main.p-2 {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
}

/* === ADMIN USER ROW CON ACCIONES === */
.admin-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.admin-user-row:hover {
    background: rgba(255,255,255,0.05);
}

.admin-user-label {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    cursor: pointer;
}

.admin-user-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.admin-user-row:hover .admin-user-actions {
    opacity: 1;
}

.btn-user-history,
.btn-user-profile {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.15s;
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.btn-user-history:hover,
.btn-user-profile:hover {
    background: rgba(99, 102, 241, 0.4);
    color: white;
}

.btn-user-delete {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.15s;
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.btn-user-delete:hover {
    background: rgba(239, 68, 68, 0.4);
    color: white;
}

/* === Search History Card === */
.search-history-card .card-body {
    max-height: 250px;
    overflow-y: auto;
}

.btn-clear-history {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.15s;
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.btn-clear-history:hover {
    background: rgba(239, 68, 68, 0.4);
    color: white;
}

.btn-clear-history.hidden {
    display: none;
}

.search-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.search-history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sh-info {
    flex: 1;
    min-width: 0;
}

.sh-term {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sh-meta {
    display: flex;
    gap: 6px;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
}

.sh-who {
    color: rgba(255, 255, 255, 0.5);
}

.sh-alexa {
    color: #39ff14;
    text-shadow: 0 0 6px rgba(57, 255, 20, 0.4);
}

.sh-count {
    color: #818cf8;
}

.sh-actions {
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.search-history-item:hover .sh-actions {
    opacity: 1;
}

.btn-retry-search,
.btn-delete-search {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    transition: all 0.15s;
}

.btn-retry-search {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.btn-retry-search:hover {
    background: rgba(99, 102, 241, 0.4);
    color: white;
}

.btn-delete-search {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.btn-delete-search:hover {
    background: rgba(239, 68, 68, 0.35);
    color: white;
}
