/* 
   I ❤️ PROMO - Minimalist Premium Design System
   Refined: Compact List Layout (1 per row) - Ultra Minimalist.
*/

:root {
    --primary: #9f1239;
    --primary-hover: #be123c;
    --primary-light: #fff1f2;
    --accent: #be123c;
    --bg-main: #f9fafb;
    --bg-card: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.95);
    --text-main: #374151;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --border: #f1f5f9;
    --shadow-hover: 0 4px 12px -2px rgba(159, 18, 57, 0.08);
    --radius: 8px;
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

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

/* --- Standard Header --- */

header {
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    /* Aumentado ligeiramente para o novo layout */
    gap: 20px;
}

.logo {
    height: 56px;
    width: auto;
    display: block;
}

#admin-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    order: 3;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* User Avatar & Dropdown Logic */
.user-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.user-avatar:hover {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 220px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.user-wrapper:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.dropdown-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.dropdown-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}

.dropdown-role {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 4px;
}

/* Role Colors */
.role-admin {
    background: #fee2e2;
    color: #9f1239;
}

.role-gerente {
    background: #e0f2fe;
    color: #0369a1;
}

.role-curador {
    background: #dcfce7;
    color: #15803d;
}

.role-colaborador {
    background: #f3e8ff;
    color: #7e22ce;
}

.role-default {
    background: #f1f5f9;
    color: #475569;
}

.dropdown-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dropdown-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-link:hover {
    background: #f8fafc;
    color: var(--primary);
}

.dropdown-logout {
    color: #ef4444 !important;
}

.dropdown-logout:hover {
    background: #fee2e2;
}

.admin-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    padding: 0 20px;
    border: 1.5px solid var(--primary);
    border-radius: 12px;
    transition: all 0.2s;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.admin-link:hover {
    background: var(--primary);
    color: white;
}

/* --- Navigation Tabs --- */

nav.tabs {
    display: flex;
    justify-content: center;
    gap: 24px;
    border-top: 1px solid var(--border);
}

nav.tabs button {
    background: none;
    border: none;
    padding: 12px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

nav.tabs button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* --- Layout Wrapper --- */

.page-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 20px 20px;
    /* Reduzido padding superior de 15px para 0 */
}

.hidden {
    display: none !important;
}

/* --- Offers List (Compact & Minimalist) --- */

#g {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
}

article {
    background: var(--bg-card);
    border: 1px solid var(--border);
    /* Borda fina e discreta */
    border-radius: var(--radius);
    display: flex !important;
    flex-direction: row !important;
    overflow: hidden;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    height: 100px;
    /* Ainda mais compacto */
    width: 100%;
    align-items: center;
}

article:hover {
    background: #fafbfc;
    /* Destaque sutil de fundo */
    box-shadow: var(--shadow-hover);
    /* Sombra discreta */
    border-color: #e2e8f0;
}

.picture-wrapper {
    width: 100px;
    min-width: 100px;
    height: 100%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-right: 1px solid var(--border);
}

article img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-content {
    padding: 0 20px;
    display: flex;
    flex-direction: row;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.info-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.store-name {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.confidence-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

h2 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price-section {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: flex-end;
}

.price-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.price-old {
    font-size: 0.7rem;
    color: var(--text-light);
    text-decoration: line-through;
}

.price-new {
    font-size: 1.25rem;
    font-weight: 600;
    color: #404040;
    /* Quase preto 75% */
    letter-spacing: -0.01em;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.tag {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--border);
    padding: 1px 5px;
    border-radius: 3px;
    transition: all 0.2s;
}

.tag.tag-exact {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.tag.tag-child {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fef08a;
}

.logo-container {
    order: 1;
}

.search-header-group {
    display: flex;
    align-items: center;
    gap: 8px; /* Espaço entre a caixa e o botão Ir */
    flex: 1;
    max-width: 550px;
    order: 2;
}

.search-container {
    position: relative;
    flex: 1; /* A caixa de busca cresce */
}

.header-search {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-radius: 25px;
    padding: 2px 20px; /* Removido padding-left extra da lupa */
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.header-search:focus-within {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 4px 12px rgba(159, 18, 57, 0.08);
}

.header-search input {
    width: 100%;
    padding: 10px 0;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}

.search-button-header-external {
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 8px 12px; /* Quadrado */
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button-header-external:hover {
    background: var(--primary);
    color: white;
}

.search-icon-btn {
    pointer-events: none;
    flex-shrink: 0;
}

/* --- Filter Bar --- */
.filters {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px; /* Reduzido de 12px para 6px */
    padding: 4px 0; /* Reduzido de 8px para 4px */
    position: sticky;
    top: 73px;
    background: var(--bg-main);
    z-index: 900;
    flex-wrap: wrap;
    /* Permitir múltiplas linhas como na imagem */
}

/* Sortable Headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    position: relative;
    padding-right: 20px;
}

th.sortable:hover {
    color: var(--primary);
}

th.sortable::after {
    content: '↕';
    position: absolute;
    right: 5px;
    opacity: 0.3;
}

th.sortable.asc::after {
    content: '↑';
    opacity: 1;
    color: var(--primary);
}

th.sortable.desc::after {
    content: '↓';
    opacity: 1;
    color: var(--primary);
}

.filters-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 6px;
    /* Reduzido de 8px */
    padding: 4px 0;
}

.filters-wrapper::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.filters b {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 12px;
    flex-shrink: 0;
}

.filters .btn {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    background: white;
    border: 1px solid #e2e8f0;
    padding: 3px 8px;
    /* Reduzido de 4px 10px */
    border-radius: 12px;
    /* Reduzido de 16px */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    flex-shrink: 0;
    text-transform: none;
}

.filters .btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.filters .btn.on {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(159, 18, 57, 0.2);
}

/* --- Load More --- */
.btn-load-more {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 24px auto;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-load-more:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* --- Floating Action Button (Back to top) --- */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    border: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.fab.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab:hover {
    background-color: #4f46e5;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.fab:active {
    transform: translateY(0) scale(0.95);
}

/* --- Main Footer --- */
.main-footer {
    padding: 24px 0 32px 0;
    border-top: 1px solid var(--border);
    margin-top: 16px;
}

.footer-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

.footer-brand {
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.footer-links a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a[href^="mailto:"] {
    color: var(--primary);
    font-weight: 600;
}

.footer-links a:hover {
    color: var(--primary-hover);
}

.footer-sep {
    color: #cbd5e1;
    font-weight: 900;
}

.footer-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--text-light) !important;
    margin-top: 12px;
}

/* State Specific Avatar Styles */
.role-disabled {
    background: #e2e8f0;
    color: #94a3b8;
    border: 2px dashed #cbd5e1;
    opacity: 0.7;
}

.role-disabled:hover {
    opacity: 1;
    border-color: var(--primary);
    color: var(--primary);
    background: var(--white);
}

.user-wrapper:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(8px);
}

.dropdown-role.role-admin {
    background: #fee2e2;
    color: #9f1239;
}

.dropdown-role.role-gerente {
    background: #e0f2fe;
    color: #0369a1;
}

.dropdown-role.role-curador {
    background: #dcfce7;
    color: #15803d;
}

.dropdown-role.role-colaborador {
    background: #f3e8ff;
    color: #7e22ce;
}

.dropdown-role.role-viewer {
    background: #f1f5f9;
    color: #475569;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 600px) {
    .header-container {
        padding: 4px 16px 12px 16px;
    }

    .header-top {
        height: auto;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: space-between;
        padding-top: 8px;
    }

    .logo-container {
        order: 1;
        flex: 0 0 auto;
        display: flex;
        align-items: center;
    }

    .logo {
        height: 28px;
        margin: 0;
    }

    #admin-controls {
        order: 2;
        margin-left: auto;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    #login-link, .user-wrapper {
        position: static;
        right: auto;
    }

    .admin-link {
        height: 34px;
        padding: 0 12px;
        font-size: 0.75rem;
        border-radius: 8px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        font-size: 0.85rem;
    }

    .search-header-group {
        order: 3;
        width: 100%;
        max-width: 100%;
        gap: 6px;
        margin-top: 4px;
    }

    .header-search {
        padding: 0 12px;
        height: 38px;
    }

    .header-search input {
        font-size: 0.82rem;
        padding: 6px 0;
    }

    .search-button-header-external {
        height: 38px;
        min-width: 38px;
        padding: 4px;
        border-radius: 8px;
    }

    .filters {
        margin: 0 0 12px 0;
        padding: 0;
        background: var(--bg-main);
        border-bottom: none;
        position: relative;
        top: 0;
    }

    .filters b {
        display: none;
    }

    .filters-wrapper {
        padding-right: 0;
        justify-content: flex-start;
        gap: 4px;
    }

    .filters .btn {
        padding: 3px 10px;
        font-size: 0.6rem;
        border-radius: 10px;
    }

    article {
        height: auto;
        flex-direction: row !important;
        min-height: 100px;
        padding: 1px;
    }

    .picture-wrapper {
        width: 100px;
        min-width: 100px;
        height: 100px;
        border-right: none;
        padding: 12px;
    }

    .card-content {
        padding: 10px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        justify-content: center;
    }

    .info-main {
        width: 100%;
        gap: 1px;
    }

    h2 {
        font-size: 0.9rem;
        font-weight: 500;
        line-height: 1.25;
        max-height: 2.5em;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-clamp: 2;
        white-space: normal;
    }

    .card-meta {
        margin-bottom: 0;
    }

    .tags {
        display: none;
    }

    .price-section {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
        border: none;
        padding-top: 0;
        margin-top: 2px;
    }

    .price-box {
        align-items: flex-start;
    }

    .price-new {
        font-size: 1.15rem;
        font-weight: 700;
    }

    .price-old {
        font-size: 0.65rem;
    }

    .page-wrapper {
        padding: 0 16px 40px 16px;
    }
}