:root {
    --bg-main: #0f172a;
    /* Slate 900 */
    --bg-card: rgba(30, 41, 59, 0.7);
    /* Slate 800 with alpha */
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #eab308;
    /* Gold/Amber */
    --success: #22c55e;
    --error: #ef4444;
    --info: #3b82f6;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header & Branding */
.main-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.brand-name {
    color: #3b82f6;
    /* Azul marca semi-brillante */
}

.brand-suffix {
    color: var(--text-primary);
    opacity: 0.9;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-right-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-label {
    font-size: 0.825rem;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
}

.back-btn:hover {
    transform: translateX(-4px);
    color: var(--accent);
}

/* User Menu & Dropdown */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.kebab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    line-height: 1;
}

.kebab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1e293b;
    /* Slate 800 */
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    min-width: 160px;
    display: none;
    /* Hidden by default */
    z-index: 200;
    overflow: hidden;
}

.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

.dropdown-item {
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-align: left;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: rgba(234, 179, 8, 0.1);
    color: var(--accent);
}

/* Card Style */
.premium-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#scannerInput {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#scannerInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2);
}

/* Buttons */
.controls-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

#undoBtn:hover {
    border-color: var(--info);
    color: var(--info);
}

#eraseBtn:hover {
    border-color: var(--error);
    color: var(--error);
}

#exportBtn:hover {
    border-color: var(--success);
    color: var(--success);
}

/* Status & Counter */
.status-section {
    text-align: center;
}

.status-banner {
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.status-banner.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border-color: rgba(59, 130, 246, 0.2);
    animation: pulse 2s infinite;
}

.status-banner.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.2);
}

.status-banner.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Status Row Layout */
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.location-container {
    flex: 2;
    min-width: 0;
}

#locationInput {
    width: 100%;
    height: 42px;
    /* Aumentado para concordar con el chip */
    padding: 0 1.25rem;
    font-size: 0.95rem;
    background: rgba(15, 23, 42, 0.45);
    /* Slate oscuro */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(234, 179, 8, 0.25);
    /* Dorado tenue */
    border-radius: 0.75rem;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#locationInput::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

#locationInput:focus {
    border-color: var(--accent);
    /* Dorado sólido */
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.2);
}

.pending-counter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 0 1.5rem;
    border-radius: 2rem;
    border: 1px solid var(--glass-border);
    white-space: nowrap;
    height: 42px;
    box-sizing: border-box;
}

.pending-counter.has-pending {
    color: var(--accent);
    border-color: rgba(234, 179, 8, 0.4);
    background: rgba(234, 179, 8, 0.05);
}

/* Table */
.table-section {
    overflow: hidden;
}

.table-container {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 0.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead {
    background: rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
}

th {
    padding: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.1em;
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Custom Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

/* Mobile Media Query */
@media (max-width: 650px) {
    .controls-section {
        grid-template-columns: 1fr;
    }

    .premium-card {
        padding: 1rem;
    }

    .container {
        padding: 1rem;
    }

    .status-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .location-container {
        max-width: none;
    }

    #locationInput,
    .pending-counter {
        height: 46px;
        /* Aumentado ligeramente para touch en móvil */
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-title {
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-danger {
    background-color: #ef4444;
    /* Red-500 */
    border: 1px solid #ef4444;
    color: white;
    transition: all 0.2s;
}

.btn-danger:hover {
    background-color: #dc2626;
    /* Red-600 */
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.4);
}