/* ================================================================
   DemoPizza — Components: Tarjetas, Carrito, Checkout, Auth, Modal
   ================================================================ */

/* ── Tarjeta de producto ──────────────────────────────────────── */
.product-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-img-wrap {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--color-bg-alt);
}

.product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-img-wrap img {
    transform: scale(1.05);
}

.product-body {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-name {
    font-size: var(--text-lg);
    font-weight: var(--font-semi);
    margin-bottom: var(--space-2);
    color: var(--color-dark);
}

.product-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: var(--leading-normal);
    margin-bottom: var(--space-4);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: auto;
}

.product-price {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-primary);
}

/* Favorito + rating */
.product-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-3);
}

.btn-fav {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
    transition: transform var(--transition-fast);
    color: var(--color-text-muted);
}

.btn-fav:hover, .btn-fav.active { color: var(--color-primary); transform: scale(1.2); }

.stars {
    display: flex;
    gap: 2px;
}

.star {
    cursor: pointer;
    font-size: 1rem;
    color: var(--color-border);
    transition: color var(--transition-fast), transform var(--transition-fast);
    user-select: none;
}

.star.filled, .star:hover { color: #f4a261; }
.star:hover { transform: scale(1.2); }

/* ── Selector de talla ────────────────────────────────────────── */
.size-selector {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.size-btn {
    padding: var(--space-1) var(--space-3);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-white);
    cursor: pointer;
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.size-btn:hover, .size-btn.selected {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-white);
}

/* ── Carrito lateral / mini carrito ───────────────────────────── */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: min(420px, 100vw);
    height: 100vh;
    background: var(--color-white);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    transition: right var(--transition-normal);
}

.cart-drawer.open { right: 0; }

.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.cart-drawer-header h2 { font-size: var(--text-xl); }

.cart-drawer-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
    line-height: 1;
}

.cart-drawer-close:hover { color: var(--color-text); }

.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-6);
}

.cart-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: var(--space-3);
    align-items: center;
    padding-block: var(--space-4);
    border-bottom: 1px solid var(--color-bg-alt);
}

.cart-item-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--color-bg-alt);
}

.cart-item-name {
    font-size: var(--text-sm);
    font-weight: var(--font-semi);
}

.cart-item-price {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-white);
    cursor: pointer;
    font-size: var(--text-lg);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.qty-btn:hover { background: var(--color-primary); border-color: var(--color-primary); color: white; }

.cart-item-total {
    font-weight: var(--font-bold);
    color: var(--color-primary);
    min-width: 60px;
    text-align: right;
}

.cart-empty-msg {
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--space-12) var(--space-6);
    font-size: var(--text-lg);
}

.cart-drawer-footer {
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--color-border);
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.cart-subtotal {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

/* Overlay */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.drawer-overlay.open { opacity: 1; visibility: visible; }

/* ── Auth: Login / Registro ───────────────────────────────────── */
.auth-page {
    min-height: calc(100vh - var(--navbar-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
    background: var(--color-bg-alt);
}

.auth-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-10);
    width: 100%;
    max-width: 440px;
}

.auth-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-2);
    text-align: center;
}

.auth-subtitle {
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: var(--space-8);
    font-size: var(--text-sm);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

/* ── Badges / Pills ───────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semi);
    line-height: 1;
}

.badge-primary   { background: rgba(230,57,70,.12); color: var(--color-primary); }
.badge-success   { background: #d1fae5; color: #065f46; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: var(--color-bg-alt); color: var(--color-text-muted); }

/* ── Tabla admin ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    background: var(--color-bg-alt);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: var(--font-semi);
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-bg-alt);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--color-bg-alt); }

/* ── Loading spinner ──────────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .auth-card { padding: var(--space-6); }
    .cart-drawer { width: 100vw; right: -100vw; }
}
