:root {
    --bg: #0f0f1a;
    --surface: #1a1a2a;
    --surface2: #222238;
    --accent: #e94560;
    --accent2: #4ade80;
    --accent3: #60a5fa;
    --text: #f1f1f3;
    --text2: #8899aa;
    --border: #2a2a40;
    --radius: 14px;
    --radius-sm: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.estado {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text2);
    background: var(--surface2);
    padding: 6px 14px;
    border-radius: 20px;
}

.estado-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #555;
}

.estado.conectado .estado-dot {
    background: var(--accent2);
}

.estado.conectado {
    color: var(--accent2);
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text2);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}

.tab.active {
    background: var(--surface);
    color: var(--text);
}

/* ===== TAB CONTENT ===== */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.tab-content.active {
    display: block;
}

/* ===== GALERÍA ===== */
.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.galeria-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s;
}

.galeria-card:hover {
    border-color: var(--accent3);
    transform: translateY(-2px);
}

.galeria-card:active {
    transform: scale(0.97);
}

.galeria-preview {
    width: 100%;
    aspect-ratio: 3/4;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.galeria-preview canvas {
    width: 100%;
    height: 100%;
}

.galeria-info {
    padding: 12px;
}

.galeria-nombre {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.galeria-desc {
    font-size: 11px;
    color: var(--text2);
    line-height: 1.4;
}

/* ===== MIS PANTALLAS ===== */
.mis-pantallas-header {
    margin-bottom: 16px;
}

.hint {
    font-size: 12px;
    color: var(--text2);
}

.pantallas-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pantalla-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: grab;
    transition: all 0.2s;
}

.pantalla-item:active {
    cursor: grabbing;
}

.pantalla-item.dragging {
    opacity: 0.5;
    border-color: var(--accent3);
}

.pantalla-item .drag-handle {
    display: flex;
    align-items: center;
    color: var(--text2);
    font-size: 20px;
}

.pantalla-thumb {
    width: 48px;
    height: 64px;
    background: #000;
    border-radius: 6px;
    flex-shrink: 0;
    overflow: hidden;
}

.pantalla-thumb canvas {
    width: 100%;
    height: 100%;
}

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

.pantalla-info .nombre {
    font-size: 14px;
    font-weight: 500;
}

.pantalla-info .meta {
    font-size: 11px;
    color: var(--text2);
    margin-top: 2px;
}

.pantalla-item .btn-quitar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.pantalla-item .btn-quitar:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== BOTÓN GUARDAR ===== */
.btn-guardar {
    width: 100%;
    margin-top: 20px;
    padding: 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-guardar:hover {
    opacity: 0.9;
}

.btn-guardar:active {
    transform: scale(0.98);
}

/* ===== MODAL PREVIEW ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-preview {
    background: var(--surface);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 320px;
    text-align: center;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-screen {
    width: 180px;
    height: 240px;
    background: #000;
    border-radius: 14px;
    margin: 0 auto 16px;
    overflow: hidden;
    border: 2px solid var(--border);
}

.preview-screen canvas {
    width: 100%;
    height: 100%;
}

.preview-nombre {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
}

.btn-añadir {
    width: 100%;
    padding: 14px;
    background: var(--accent3);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-añadir:active {
    transform: scale(0.97);
}

.btn-añadir.añadido {
    background: var(--accent2);
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface2);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 300;
    border: 1px solid var(--border);
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}
