:root {
    --primary-pink: #D955E0;
    --primary-pink-dark: #b83ebd;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-color: #333;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: #f0f0f0;
    color: var(--text-color);
    overflow: hidden;
}

.overlay {
    display: none;
}

.mobile-menu-btn {
    display: none;
}

.app-container {
    position: relative;
    display: flex;
    width: 100%;
    height: 100dvh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 250, 252, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 30px 25px;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), padding 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed {
    width: 70px;
    padding: 25px 15px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--primary-pink);
    font-size: 1.8rem;
    cursor: pointer;
    margin-bottom: 20px;
    align-self: flex-end;
    transition: transform 0.3s ease;
}

.toggle-btn:hover {
    transform: scale(1.06);
}

.sidebar.collapsed .toggle-btn {
    align-self: center;
    margin-bottom: 30px;
}

.brand-logo {
    font-family: "Didot", "Bodoni MT", "Noto Serif Display", serif;
    font-size: 2.2rem;
    color: var(--primary-pink);
    font-weight: 700;
    font-style: italic;
    text-align: center;
    margin-bottom: 40px;
    cursor: pointer;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease, height 0.3s ease, margin 0.3s ease;
    position: relative;
    padding-bottom: 20px;
}

.brand-logo::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 40px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-pink), transparent);
}

.sidebar.collapsed .brand-logo {
    opacity: 0;
    height: 0;
    margin-bottom: 0;
    overflow: hidden;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.nav-item {
    margin-bottom: 10px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid transparent;
    text-decoration: none;
    color: #666;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
    color: var(--primary-pink);
    background-color: rgba(255, 255, 255, 0.6);
    border-color: rgba(217, 85, 224, 0.2);
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-pink-dark));
    box-shadow: 0 8px 20px rgba(217, 85, 224, 0.3);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .nav-link .link-text {
    display: none;
}

.sidebar.collapsed .nav-icon {
    margin: 0;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    padding-top: 20px;
}

.logout-form {
    margin: 0;
}

.logout-footer-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 15px;
    border: 1px solid var(--primary-pink);
    border-radius: 12px;
    background: transparent;
    color: var(--primary-pink);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-footer-btn:hover {
    color: #fff;
    background: var(--primary-pink);
    box-shadow: 0 4px 10px rgba(217, 85, 224, 0.3);
}

.login-footer-btn {
    margin-top: 10px;
}

.sidebar.collapsed .logout-footer-btn {
    padding: 12px 10px;
}

.sidebar.collapsed .logout-footer-btn .link-text {
    display: none;
}

.CAtagoloProdutos {
    flex: 1;
    min-width: 0;
    padding: 30px 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #f0f0f0;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.page-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    color: #444;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.5);
}

.actions-bar {
    display: flex;
    align-items: center;
    width: min(100%, 760px);
    margin-left: auto;
    gap: 15px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 260px;
}

.search-box input {
    width: 100%;
    padding: 14px 45px 14px 20px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: #333;
    font-size: 1.05rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input:focus {
    width: 100%;
    border-color: var(--primary-pink);
    background: #fff;
    box-shadow: 0 0 10px rgba(217, 85, 224, 0.2);
}

.search-submit {
    position: absolute;
    right: 14px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #777;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.filter-select {
    min-width: 220px;
    width: auto;
    flex: 0 0 clamp(220px, 30vw, 300px);
    padding: 14px 25px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: #555;
    font-size: 1.05rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:hover,
.filter-select:focus {
    background: #fff;
    border-color: var(--primary-pink);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px;
    padding-bottom: 20px;
}

.product-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    min-height: 395px;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
}

.product-image-placeholder {
    width: 100%;
    height: 220px;
    border-radius: 16px;
    margin-bottom: 15px;
    background-color: #fdf2fe;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.5rem;
    overflow: hidden;
    border: 2.5px solid #d955e0;
    box-shadow: 0 0 16px rgba(217, 85, 224, 0.4), 0 0 4px rgba(217, 85, 224, 0.2);
    transition: all 0.3s ease;
}

.product-card:hover .product-image-placeholder {
    box-shadow: 0 0 24px rgba(217, 85, 224, 0.7), 0 0 8px rgba(217, 85, 224, 0.4);
    border-color: #b83ebd;
    transform: scale(1.02);
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 14px;
    display: block;
    transition: transform 0.3s ease;
}

.product-title {
    margin: 5px 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    min-height: 2.7em;
    display: flex;
    align-items: center;
    text-align: center;
}

.product-status {
    margin: 0 0 8px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.product-status.ativo {
    color: #2e7d32;
}

.product-status.esgotado {
    color: #d9534f;
}

.product-meta {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    color: #666;
    font-size: 0.9rem;
}

.product-price {
    color: var(--primary-pink);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 15px;
    min-height: 1em;
}

.btn-buy {
    width: 100%;
    margin-top: auto;
    padding: 10px;
    border: 2px solid var(--primary-pink);
    border-radius: 10px;
    background: transparent;
    color: var(--primary-pink);
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-buy:hover {
    color: #fff;
    background: var(--primary-pink);
}

.btn-buy-disabled {
    border-color: #d7d7d7;
    color: #8a8a8a;
    cursor: not-allowed;
    pointer-events: none;
    background: #f3f3f3;
}

.empty-products {
    grid-column: 1 / -1;
    text-align: center;
    color: #777;
    font-weight: 600;
    padding: 24px;
    border: 1px dashed #ccc;
    border-radius: 12px;
    background: #fff;
}

.CAtagoloProdutos::-webkit-scrollbar {
    width: 8px;
}

.CAtagoloProdutos::-webkit-scrollbar-track {
    background: transparent;
}

.CAtagoloProdutos::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: rgba(217, 85, 224, 0.4);
}

@media (max-width: 1200px) {
    .sidebar {
        width: 220px;
        padding: 24px 18px;
    }

    .actions-bar {
        width: min(100%, 700px);
    }

    .filter-select {
        flex-basis: clamp(200px, 32vw, 260px);
    }
}

@media (max-width: 992px) {
    body {
        overflow: hidden;
    }

    .mobile-menu-btn {
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 1002;
        width: 44px;
        height: 44px;
        border: none;
        border-radius: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        color: var(--primary-pink);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
        font-size: 1.2rem;
    }

    .overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
        z-index: 1000;
    }

    body.menu-open .overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(82vw, 290px);
        padding: 22px 16px;
        transform: translateX(-105%);
        transition: transform 0.28s ease;
        z-index: 1001;
        overflow-y: auto;
        white-space: normal;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar .toggle-btn {
        display: none;
    }

    .CAtagoloProdutos {
        width: 100%;
        padding: 68px 16px 16px;
    }

    .header-bar {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 18px;
        gap: 12px;
    }

    .actions-bar {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1.3fr) minmax(165px, 1fr);
        gap: 10px;
        margin-left: 0;
    }

    .actions-bar > * {
        min-width: 0;
    }

    .search-box {
        width: 100%;
        min-width: 0;
    }

    .search-box input,
    .search-box input:focus {
        width: 100%;
    }

    .filter-select {
        width: 100%;
        min-width: 0;
        flex: initial;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .product-card {
        padding: 12px;
        min-height: 315px;
    }

    .product-image-placeholder {
        height: 130px;
        font-size: 1.2rem;
    }

    .product-title {
        font-size: 1rem;
    }

    .product-price {
        font-size: 1.7rem;
        margin-bottom: 10px;
    }

    .btn-buy {
        padding: 8px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .actions-bar {
        grid-template-columns: minmax(0, 1fr) minmax(132px, 1fr);
        gap: 8px;
    }

    .search-box input,
    .filter-select {
        font-size: 0.95rem;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .filter-select {
        min-width: 0;
        padding-left: 14px;
        padding-right: 28px;
    }

    .page-title {
        font-size: 1.45rem;
    }
}
