:root {
    --peach-50: #fff8f2;
    --peach-100: #fcebdc;
    --peach-300: #f2c9a5;
    --peach-400: #ecb488;
    --peach-500: #d89b67;
    --navy-900: #0f1630;
    --navy-700: #1a2550;
    --ink-900: #2b2b30;
    --ink-600: #5a5a63;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    color: var(--ink-900);
    background: radial-gradient(circle at 15% 10%, #fff7ef 0%, #f6eee8 45%, #f2e7df 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: -20% auto auto -20%;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(236, 180, 136, 0.28), rgba(236, 180, 136, 0));
    pointer-events: none;
    z-index: -1;
    animation: drift 14s ease-in-out infinite;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 16px 30px;
    background: linear-gradient(125deg, #aa7930, #d8aa56);
    color: var(--white);
    border-bottom: 3px solid rgba(236, 180, 136, 0.55);
    box-shadow: 0 10px 30px rgba(11, 16, 35, 0.35);
    animation: slide-down 0.65s ease;
}

.logo-container-link {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    cursor: pointer;
    align-items: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.logo-container-link:hover {
    opacity: 0.95;
    transform: translateY(-2px);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-container img {
    width: 104px;
    height: auto;
    object-fit: contain;
    display: block;
    border: 3px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    background: var(--white);
    padding: 8px;
    box-shadow: 0 0 0 5px rgba(236, 180, 136, 0.22), 0 12px 24px rgba(0, 0, 0, 0.2);
}

.logo-container h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--white);
    font-weight: 800;
    letter-spacing: 3px;
}

.logo-container p {
    margin: 6px 0 0;
    color: #e6dfd8;
    font-size: 1.05rem;
}

.shop-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.shop-controls input[type="search"] {
    padding: 10px 14px;
    border: 2px solid rgba(236, 180, 136, 0.45);
    border-radius: 999px;
    width: 260px;
    max-width: 300px;
    background: var(--white);
    outline: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.shop-controls input[type="search"]:focus {
    border-color: var(--peach-400);
    box-shadow: 0 0 0 4px rgba(236, 180, 136, 0.22);
}

.hidden {
    display: none !important;
}

.auth-open-btn,
.auth-logout-btn {
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
}

.auth-open-btn:hover,
.auth-logout-btn:hover {
    background: rgba(255, 255, 255, 0.24);
}

.auth-role-badge {
    border-radius: 999px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 5000;
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.app-toast {
    min-width: 240px;
    max-width: min(92vw, 380px);
    border-radius: 12px;
    color: #fff;
    font-weight: 700;
    padding: 12px 14px;
    box-shadow: 0 14px 30px rgba(28, 19, 9, 0.35);
    background: linear-gradient(130deg, #7e4f25, #d8aa56);
    border: 1px solid rgba(255, 255, 255, 0.24);
    animation: toast-in 0.24s ease, toast-out 0.3s ease 2.7s forwards;
}

.app-toast.success {
    background: linear-gradient(130deg, #5a7d24, #7db93e);
}

.app-toast.error {
    background: linear-gradient(130deg, #8b2d2d, #cd4c4c);
}

.cart-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(236, 180, 136, 0.4);
    background: rgba(255, 255, 255, 0.11);
    backdrop-filter: blur(3px);
    color: #fff6ee;
    font-weight: 700;
}

.cart-icon {
    font-size: 1.2em;
    display: inline-block;
    animation: cart-pulse 1.35s ease-in-out infinite;
}

.cart-bounce {
    animation: cart-bounce 0.38s ease;
}

.main-content {
    max-width: 1250px;
    margin: 30px auto;
    padding: 0 24px;
}

.shop-section {
    margin-bottom: 28px;
    animation: fade-up 0.7s ease;
}

.admin-panel {
    margin: 42px auto 0;
    max-width: 1180px;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid rgba(150, 101, 58, 0.2);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(250, 242, 234, 0.9));
    box-shadow: 0 18px 34px rgba(44, 30, 21, 0.13);
}

.admin-panel h2 {
    margin-top: 0;
}

.admin-panel > p {
    margin: 0 0 14px;
}

.admin-shell {
    display: grid;
    grid-template-columns: minmax(320px, 1.05fr) minmax(320px, 0.95fr);
    gap: 16px;
    align-items: start;
}

.admin-form-card,
.admin-list-card {
    border: 1px solid #ead6c4;
    border-radius: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.9);
}

.admin-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    border: 1px solid #d7bca4;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.95rem;
}

.admin-tools {
    margin: 2px 0 16px;
    display: grid;
    gap: 8px;
}

.admin-tools label {
    font-weight: 700;
    color: #6a4527;
}

.admin-tools input {
    border: 1px solid #d7bca4;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.95rem;
}

.btn.secondary {
    background: #fff;
    color: #7d4f27;
    border: 1px solid rgba(125, 79, 39, 0.45);
    box-shadow: none;
}

.admin-products {
    display: grid;
    gap: 10px;
}

.admin-product-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 10px;
    align-items: center;
    border: 1px solid #ead6c4;
    border-radius: 10px;
    padding: 8px;
    background: #fff;
}

.admin-product-main {
    display: grid;
    gap: 6px;
}

.admin-quick-edit {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 4px;
}

.admin-quick-edit input,
.admin-quick-edit select {
    border: 1px solid #d7bca4;
    border-radius: 8px;
    padding: 8px;
    font-size: 0.9rem;
    min-width: 110px;
}

.admin-product-row img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
}

.admin-product-actions {
    display: flex;
    gap: 8px;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    background: rgba(24, 16, 7, 0.55);
    backdrop-filter: blur(4px);
    padding: 16px;
    animation: auth-overlay-in 0.2s ease;
}

.auth-modal-content {
    width: min(500px, 95vw);
    border-radius: 18px;
    background: linear-gradient(180deg, #fffaf5 0%, #fff 100%);
    border: 1px solid rgba(195, 141, 89, 0.35);
    padding: 20px;
    position: relative;
    box-shadow: 0 24px 48px rgba(41, 29, 17, 0.3);
    animation: auth-modal-in 0.24s ease;
}

.auth-modal-content h3 {
    margin: 0 0 14px;
    font-size: 1.9rem;
    color: #5f3c20;
}

.auth-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    border: 1px solid #d8c4b3;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
}

.auth-mode-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.auth-mode-buttons .btn {
    flex: 1;
    font-size: 1.05rem;
}

.auth-form {
    display: grid;
    gap: 12px;
}

.auth-field {
    display: grid;
    gap: 6px;
}

.auth-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #6a4527;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    opacity: 0.75;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.auth-input {
    width: 100%;
    border: 1px solid #d7bca4;
    border-radius: 10px;
    padding: 11px 44px 11px 40px;
    font-size: 1rem;
    background: #fffefc;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.78;
    padding: 2px;
    line-height: 1;
}

.auth-toggle-password:hover {
    opacity: 1;
}

.auth-toggle-password:focus-visible {
    outline: 2px solid rgba(195, 141, 89, 0.55);
    outline-offset: 2px;
    border-radius: 4px;
}

.auth-input:focus {
    border-color: #c38d59;
    box-shadow: 0 0 0 3px rgba(211, 167, 120, 0.22);
}

.auth-input-wrap:focus-within .auth-input-icon {
    opacity: 1;
    transform: translateY(-50%) scale(1.08);
}

.auth-helper {
    margin: 0;
    font-size: 0.88rem;
    color: #7a6a5e;
}

.auth-message {
    min-height: 20px;
    margin: 10px 0 0;
    font-size: 0.9rem;
}

@keyframes auth-modal-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes auth-overlay-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

.shop-section h2 {
    margin: 0 0 18px;
    color: var(--ink-900);
    font-size: 2.6rem;
    letter-spacing: 0.5px;
}

.category-tabs {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    justify-content: center;
}

.tab-button {
    background: linear-gradient(160deg, #ffffff, #f6f0ea);
    border: 2px solid #e6d5c6;
    color: #5a3c2a;
    border-radius: 16px;
    padding: 14px 30px;
    cursor: pointer;
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: 0.6px;
    box-shadow: 0 10px 20px rgba(66, 39, 21, 0.12);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.tab-button.active {
    background: linear-gradient(125deg, var(--peach-500), var(--peach-400));
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 14px 30px rgba(216, 155, 103, 0.45);
    animation: glow 2.2s ease-in-out infinite;
}

.tab-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 28px rgba(66, 39, 21, 0.2);
}

.tab-button:active {
    transform: translateY(-1px);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    animation: card-in 0.5s ease forwards;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 12px;
    animation: empty-float 2.8s ease-in-out infinite;
}

.empty-state-face {
    font-size: 2rem;
    color: #c4956a;
    margin-bottom: 14px;
    letter-spacing: 2px;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3a2d24;
    margin: 0 0 8px;
}

.empty-state-subtitle {
    font-size: 1.1rem;
    color: #7a6558;
    margin: 0;
    line-height: 1.7;
}

@keyframes empty-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.product-card {
    background: linear-gradient(175deg, rgba(255, 255, 255, 0.95), rgba(249, 241, 234, 0.98));
    border: 1px solid rgba(216, 155, 103, 0.25);
    border-radius: 16px;
    box-shadow: 0 10px 26px rgba(88, 54, 30, 0.11);
    padding: 14px;
    transform: translateY(14px);
    opacity: 0;
    animation: card-in 0.5s ease forwards;
}

.product-card:nth-child(2) {
    animation-delay: 0.08s;
}

.product-card:nth-child(3) {
    animation-delay: 0.16s;
}

.product-card:nth-child(4) {
    animation-delay: 0.24s;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 34px rgba(88, 54, 30, 0.2);
}

.product-card img {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(216, 155, 103, 0.2);
}

.product-card h3 {
    margin: 10px 0 6px;
    font-size: 2rem;
    color: #3a2d24;
}

.product-card p {
    margin: 0 0 10px;
    color: var(--ink-600);
    font-size: 1.2rem;
}

.price {
    font-weight: 800;
    color: #61442f;
    margin-bottom: 10px;
    font-size: 2rem;
}

.stock-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    margin-bottom: 8px;
}

.stock-badge.disponible {
    background: rgba(70, 160, 95, 0.16);
    color: #1c7a34;
    border: 1px solid rgba(70, 160, 95, 0.3);
}

.stock-badge.agotado {
    background: rgba(191, 76, 76, 0.14);
    color: #9b2f2f;
    border: 1px solid rgba(191, 76, 76, 0.32);
}

.btn-out-stock,
.btn-out-stock:hover {
    background: linear-gradient(135deg, #bcaea0, #a19386);
    box-shadow: none;
    filter: none;
    transform: none;
    cursor: not-allowed;
}

.btn {
    display: inline-block;
    background: linear-gradient(125deg, var(--peach-500), var(--peach-400));
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 8px 16px rgba(216, 155, 103, 0.35);
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.03);
    box-shadow: 0 11px 20px rgba(216, 155, 103, 0.44);
}

.floating-cart-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    background: linear-gradient(135deg, var(--peach-500), var(--peach-400));
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 14px 30px rgba(216, 155, 103, 0.45);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease;
}

.floating-cart-btn:hover {
    transform: translateY(-4px);
}

.floating-whatsapp-btn {
    position: fixed;
    right: 20px;
    bottom: 84px;
    z-index: 2000;
    background: linear-gradient(135deg, #25d366, #1fb956);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 14px 30px rgba(21, 128, 61, 0.35);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.floating-whatsapp-btn:hover {
    transform: translateY(-4px);
    filter: brightness(1.06);
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(390px, 92vw);
    height: 100vh;
    background: linear-gradient(180deg, #fffdfb, #faefe4);
    color: var(--ink-900);
    box-shadow: -2px 0 30px rgba(39, 23, 12, 0.22);
    transform: translateX(100%);
    transition: transform 0.34s ease;
    z-index: 2100;
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    transform: translateX(0);
}

.cart-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid #e7d6c7;
}

#close-cart-drawer {
    border: 1px solid #d8bea7;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
}

.cart-items {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9dbcf;
}

.cart-item .item-name {
    font-size: 0.95rem;
    font-weight: 700;
}

.cart-item .item-price {
    font-size: 0.9rem;
    color: #6f5c4d;
}

.cart-item .item-details {
    max-width: 56%;
}

.cart-item .item-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn,
.remove-item {
    border: 1px solid #d6c2b0;
    border-radius: 6px;
    background: #fff;
    color: #5b4637;
    cursor: pointer;
    width: 26px;
    height: 26px;
    line-height: 1;
    font-size: 1rem;
    display: grid;
    place-items: center;
}

.qty-btn:hover,
.remove-item:hover {
    background: #f8eee5;
}


.cart-drawer-footer {
    padding: 14px;
    border-top: 1px solid #e7d6c7;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-total-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    color: #4d3f34;
}

.cart-total-line.total {
    font-weight: 900;
    font-size: 1.2rem;
    color: #c47f49;
}

footer,
.site-footer {
    text-align: center;
    padding: 28px 0;
    background: linear-gradient(120deg, #2f2f35, #3a3835);
    color: #fff8ef;
    margin-top: 34px;
    border-top: 2px solid rgba(236, 180, 136, 0.4);
}

footer p,
.site-footer p {
    margin: 0 0 10px;
    font-size: 1.05rem;
}

footer a,
.site-footer a {
    color: var(--peach-300);
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover,
.site-footer a:hover {
    color: var(--peach-400);
    text-decoration: underline;
}

@keyframes cart-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.09); }
}

@keyframes cart-bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 14px 30px rgba(216, 155, 103, 0.45); }
    50% { box-shadow: 0 18px 38px rgba(216, 155, 103, 0.62); }
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(35px, -30px) scale(1.08); }
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .site-header {
        padding: 14px 16px;
    }

    .logo-container h1 {
        font-size: 1.6rem;
    }

    .shop-section h2 {
        font-size: 2.2rem;
    }

    .tab-button {
        font-size: 1.15rem;
        padding: 11px 18px;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .logo-container img {
        width: 86px;
    }

    .logo-container h1 {
        font-size: 1.35rem;
        letter-spacing: 2px;
    }

    .logo-container p {
        font-size: 0.9rem;
    }

    .shop-controls {
        width: 100%;
        justify-content: space-between;
    }

    .shop-controls input[type="search"] {
        width: 100%;
        max-width: 100%;
    }

    .tab-button {
        width: 100%;
        text-align: center;
    }

    .floating-whatsapp-btn {
        right: 14px;
        bottom: 90px;
        min-height: 58px;
        padding: 14px 18px;
        font-size: 1.1rem;
    }

    .admin-product-row {
        grid-template-columns: 1fr;
    }

    .admin-product-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
