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

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f5f7;
    color: #222;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

.topbar {
    background: #ffffff;
    color: #111827;
    padding: 12px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-links {
    display: flex;
    gap: 12px;
    margin-left: 40px;
    margin-right: 16px;
}

.nav-links a {
    color: #111827;
    font-size: 0.9rem;
    text-decoration: none;
}

.nav-links a:hover {
    text-decoration: underline;
}

.nav-links a.active {
    font-weight: 600;
    color: #111827;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3rem;
    font-weight: 700;
}

.logo-img {
    height: 44px;
    width: auto;
    display: block;
}

.search-wrapper {
    flex: 1;
}

.user-area {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 0.8rem;
}

.user-greeting {
    color: #e5e7eb;
}

.login-button {
    background: transparent;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    color: #e5e7eb;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.8rem;
}

.login-button:hover {
    background: #e5e7eb;
    color: #111827;
}

.logout-button {
    border-color: #f87171;
    color: #fecaca;
}

.logout-button:hover {
    background: #fecaca;
    color: #b91c1c;
}

.search-wrapper input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 999px;
    border: none;
    outline: none;
    font-size: 0.95rem;
}

.cart-button {
    background: #22c55e;
    border: none;
    color: #fff;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-button:hover {
    background: #2563eb;
}

.main-content {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 24px;
    margin: 20px auto;
    align-items: flex-start;
}

.products-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.filter-group select {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.products-section h2 {
    margin-bottom: 8px;
}

.product-card {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-image {
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: 8px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.4rem;
}

.product-name {
    font-weight: 600;
}

.product-category {
    font-size: 0.8rem;
    color: #6b7280;
}

.product-price {
    font-weight: 700;
    color: #059669;
}

.product-actions {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.product-actions button {
    flex: 1;
    padding: 6px 8px;
    border-radius: 999px;
    border: none;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
}

.product-actions button:hover {
    background: #1d4ed8;
}

.cart-panel {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
    align-self: flex-start;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.cart-items {
    list-style: none;
    margin-top: 8px;
    padding-right: 4px;
    overflow-y: auto;
    flex: 1;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

.cart-item span {
    margin-right: 6px;
}

.cart-item button {
    border: none;
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.8rem;
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-weight: 600;
}

.checkout-button { /* usado como Ver carrinho */
    margin-top: 10px;
    width: 100%;
    padding: 10px 0;
    border-radius: 999px;
    border: none;
    background: #22c55e;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.checkout-button:hover {
    background: #2563eb;
}

.footer {
    margin-top: auto;
    padding: 40px 0 48px;
    background: #111827;
    font-size: 0.9rem;
    color: #e5e7eb;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
}

.footer-links a {
    color: #e5e7eb;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-collapse {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-left: 40px;
}

.footer-collapse-header {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.footer-collapse-icon {
    font-size: 0.7rem;
}

.footer-collapse-body {
    display: none;
}

.footer-collapse-body.open {
    display: flex;
}

.footer-payments {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 4px;
    margin-left: 40px;
    margin-top: 16px;
}

.footer-payments-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f9fafb;
    margin-top: 0;
}

.footer-payments-img {
    max-height: 48px;
    width: auto;
    display: block;
    background: #ffffff;
    padding: 4px 8px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

.footer .logo-img {
    height: 52px;
    filter: brightness(0) invert(1);
}

.dashboard-main,
.account-main {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card-section {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.card-section h2 {
    margin-bottom: 10px;
}

.card-section form label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.card-section form input {
    width: 100%;
    padding: 6px 8px;
    margin-top: 4px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
}

.status-text {
    font-size: 0.85rem;
    color: #4b5563;
}

.form-result {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #16a34a;
}

.form-result.error {
    color: #b91c1c;
}

.users-list {
    margin-top: 10px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.users-table th,
.users-table td {
    border: 1px solid #e5e7eb;
    padding: 4px 6px;
    text-align: left;
}

.dashboard-layout {
    display: flex;
    gap: 16px;
}

.dashboard-sidebar {
    width: 220px;
    background: #111827;
    color: #e5e7eb;
    border-radius: 10px;
    padding: 12px;
}

.dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-root {
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    border: none;
    background: #1f2937;
    color: #e5e7eb;
    cursor: pointer;
    margin-bottom: 4px;
}

.sidebar-root:hover {
    background: #374151;
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.sidebar-submenu.open {
    display: flex;
}

.sidebar-subitem {
    width: 100%;
    text-align: left;
    padding: 6px 8px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #e5e7eb;
    cursor: pointer;
    font-size: 0.85rem;
}

.sidebar-subitem:hover {
    background: #4b5563;
}

.sidebar-subitem.active {
    background: #f97316;
    color: #111827;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal.open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.4);
    z-index: 60;
}

.modal-content h2 {
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.modal-content label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.modal-content input {
    width: 100%;
    padding: 6px 8px;
    margin-top: 4px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
}

.primary-btn {
    width: 100%;
    margin-top: 10px;
    padding: 8px 0;
    border-radius: 999px;
    border: none;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.primary-btn:hover {
    background: #1d4ed8;
}

.form-error {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #b91c1c;
}

@media (max-width: 768px) {
    .topbar-content {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .cart-panel {
        position: fixed;
        right: 10px;
        bottom: 10px;
        left: 10px;
        max-height: 60vh;
        transform: translateY(120%);
        transition: transform 0.25s ease;
    }

    .cart-panel.open {
        transform: translateY(0);
    }
}
