/* Yellow Theme E-commerce Website Styles */

:root {
    --primary-yellow: #FFD700;
    --secondary-yellow: #FFF8DC;
    --dark-yellow: #DAA520;
    --light-yellow: #FFFACD;
    --text-dark: #333333;
    --text-light: #666666;
    --white: #FFFFFF;
    --gray-light: #F5F5F5;
    --gray-medium: #CCCCCC;
    --success: #28A745;
    --danger: #DC3545;
    --warning: #FFC107;
}

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

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--white);
}

/* Header Styles — managed in includes/navbar.php */

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-yellow);
    color: var(--text-dark);
}

.btn-primary:hover {
    background-color: var(--dark-yellow);
    color: var(--white);
}

.btn-secondary {
    background-color: var(--gray-medium);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background-color: var(--text-light);
    color: var(--white);
}

.btn-success {
    background-color: var(--success);
    color: var(--white);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--gray-medium);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-yellow);
}

/* Card Styles */
.card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card-header {
    background: linear-gradient(135deg, var(--secondary-yellow), var(--light-yellow));
    padding: 1rem;
    border-bottom: 1px solid var(--gray-medium);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: var(--gray-light);
    padding: 1rem;
    border-top: 1px solid var(--gray-medium);
}

/* ✅ Product Grid - Fixed Sizes & Center Alignment */
/* ══════════════════════════════════════════
   PRODUCT CARD — Universal Clean Design
   ══════════════════════════════════════════ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}
/* Force 4 columns on large screens */
@media (min-width: 1100px) {
    .product-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 769px) and (max-width: 1099px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Card shell */
.product-card {
    position: relative;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.22s, box-shadow 0.22s;
    /* No fixed height — controlled by image ratio */
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.12);
}

/* Discount badge */
.pc-discount-badge {
    position: absolute;
    top: 0.6rem; left: 0.6rem;
    background: #ef4444; color: #fff;
    font-size: 0.65rem; font-weight: 800;
    padding: 0.15rem 0.45rem; border-radius: 20px;
    z-index: 3;
}

/* Image block — fixed ratio via padding trick */
.pc-img-link {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;   /* Square images, uniform */
    overflow: hidden;
    background: #f9fafb;
    flex-shrink: 0;
}
.pc-img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.product-card:hover .pc-img { transform: scale(1.04); }
.pc-img-empty {
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; color: #d1d5db;
    width: 100%; height: 100%;
}

/* Info area */
.pc-body {
    padding: 0.7rem 0.85rem 0.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.pc-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1a1a1a;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.2rem;
}
.pc-title:hover { color: #b8860b; }
.pc-price-row {
    display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
    margin-top: auto;
}
.pc-price {
    font-size: 1.05rem;
    font-weight: 900;
    color: #DAA520;
}
.pc-price-old {
    font-size: 0.75rem;
    text-decoration: line-through;
    color: #9ca3af;
}

/* ── Hover overlay (view details) ── */
.pc-img-link { position: relative; }
.pc-img-link::after {
    content: 'View Details';
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.45);
    color: #FFD700;
    font-weight: 700; font-size: 0.82rem;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    letter-spacing: 0.05em;
}
.product-card:hover .pc-img-link::after { opacity: 1; }

/* Action buttons: Add + Qty controls */
.pc-actions {
    display: flex;
    gap: 0.35rem;
    padding: 0.5rem 0.65rem 0.65rem;
    flex-shrink: 0;
    align-items: center;
}
/* Add to cart button — shows when qty=0 */
.pc-btn-cart {
    flex: 1;
    background: #FFD700;
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    padding: 0.52rem 0.4rem;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
    text-align: center;
}
.pc-btn-cart:hover:not(:disabled) { background: #DAA520; transform: translateY(-1px); }
.pc-btn-cart:disabled { opacity: 0.38; cursor: not-allowed; background: #e5e7eb; color: #6b7280; font-size: 0.7rem; }

/* Quantity row — shows after adding */
.pc-qty-row {
    display: none; /* shown via JS */
    align-items: center;
    gap: 0.3rem;
    flex: 1;
    justify-content: center;
}
.pc-qty-row.visible { display: flex; }
.pc-qty-btn {
    width: 30px; height: 30px;
    border-radius: 7px;
    border: none;
    background: #1a1a1a;
    color: #FFD700;
    font-size: 1rem; font-weight: 900;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.pc-qty-btn:hover { background: #333; }
.pc-qty-val {
    min-width: 28px;
    text-align: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #1a1a1a;
}

/* Mobile qty adjustments */
@media (max-width: 480px) {
    .pc-qty-btn { width: 26px; height: 26px; font-size: 0.9rem; }
    .pc-qty-val { font-size: 0.82rem; }
    .pc-btn-cart { font-size: 0.68rem; padding: 0.48rem 0.3rem; }
}

/* ── MOBILE: 2 columns, auto height ── */
@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem;
    }
    .pc-body { padding: 0.55rem 0.65rem 0.3rem; }
    .pc-title { font-size: 0.78rem; min-height: 2rem; }
    .pc-price { font-size: 0.92rem; }
    .pc-actions { padding: 0.4rem 0.5rem 0.55rem; gap: 0.3rem; }
    .pc-btn-cart { font-size: 0.7rem; padding: 0.5rem 0.3rem; }
    .pc-btn-detail { padding: 0.5rem 0.55rem; font-size: 0.8rem; }
    .pc-discount-badge { font-size: 0.6rem; }
}

/* ── TABLET ── */
@media (min-width: 481px) and (max-width: 900px) {
    .product-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 1rem; }
}

/* Backward compat for old class names still used in some places */
.product-image { width:100%; height:200px; object-fit:cover; display:block; }
.product-info  { padding:0.8rem; }
.product-title { font-size:0.9rem; font-weight:700; color:#1a1a1a; margin-bottom:0.3rem; }
.product-price { font-size:1.05rem; font-weight:900; color:#DAA520; margin-bottom:0.5rem; }
.product-card-actions { display:flex; gap:0.4rem; }
.btn-cart   { flex:1; background:#FFD700; color:#1a1a1a; border:none; border-radius:8px; padding:0.5rem; font-weight:700; font-size:0.78rem; cursor:pointer; }
.btn-details { background:#1a1a1a; color:#FFD700; border-radius:8px; padding:0.5rem 0.65rem; text-decoration:none; font-size:0.78rem; font-weight:700; }


.product-category-tag {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9ca3af;
    margin-bottom: 0.3rem;
}
.product-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #1a1a1a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-rating {
    display: flex; align-items: center; gap: 0.3rem;
    font-size: 0.78rem; margin-bottom: 0.5rem;
    color: #f59e0b;
}
.product-rating-count { color: #9ca3af; font-size: 0.72rem; }
.product-price-row {
    display: flex; align-items: baseline; gap: 0.45rem;
    margin-bottom: 0.85rem; margin-top: auto; padding-top: 0.5rem;
}
.product-price {
    font-size: 1.15rem;
    font-weight: 900;
    color: #DAA520;
}
.product-price-old {
    font-size: 0.82rem;
    text-decoration: line-through;
    color: #9ca3af;
}
.product-discount-badge {
    font-size: 0.65rem; font-weight: 800;
    background: #fee2e2; color: #b91c1c;
    padding: 0.1rem 0.4rem; border-radius: 20px;
}
.product-stock-low {
    font-size: 0.68rem; font-weight: 700;
    color: #d97706; background: #fef3c7;
    padding: 0.15rem 0.5rem; border-radius: 20px;
    margin-bottom: 0.5rem; display: inline-block;
}



/* Table Styles */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-medium);
}

.table th {
    background: linear-gradient(135deg, var(--secondary-yellow), var(--light-yellow));
    font-weight: bold;
    color: var(--text-dark);
}

.table tr:hover {
    background-color: var(--light-yellow);
}

/* Login Form */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--secondary-yellow), var(--primary-yellow));
}

.login-form {
    background: var(--white);
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-dark);
    font-size: 2rem;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #D4EDDA;
    color: #155724;
    border: 1px solid #C3E6CB;
}

.alert-danger {
    background-color: #F8D7DA;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

.alert-warning {
    background-color: #FFF3CD;
    color: #856404;
    border: 1px solid #FFEAA7;
}

/* Shopping Cart */
.cart-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-medium);
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 1rem;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.cart-item-price {
    color: var(--dark-yellow);
    font-weight: bold;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.quantity-btn {
    background: var(--primary-yellow);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
}

.quantity-input {
    width: 60px;
    text-align: center;
    border: 1px solid var(--gray-medium);
    border-radius: 3px;
    padding: 0.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .product-grid {
        justify-content: center;
    }

    .product-card {
        width: 90%;
    }


    
    .container {
        padding: 0 1rem;
    }
}

/* ===== Added UI tweaks ===== */
.icon-btn { display: inline-flex; align-items: center; gap: 0.5rem; }
.card-header h3 { display: inline-flex; align-items: center; gap: 0.5rem; }
.badge-status { padding: 0.25rem 0.5rem; border-radius: 6px; font-size: 0.85rem; }

/* ✅ Category Icons Bar */
.category-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-dark);
    transition: transform 0.3s ease, color 0.3s ease;
}

.category-icon:hover {
    transform: translateY(-5px);
    color: var(--dark-yellow);
}

.category-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin-bottom: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-icon.active .category-circle {
    border: 3px solid var(--primary-yellow);
}

.category-icon.active span {
    color: var(--dark-yellow);
}

.category-icon span {
    font-size: 0.9rem;
    font-weight: 500;
}



/* =============================================
   Responsive Design — Final Clean Version
   ============================================= */

/* الهاتف الصغير < 480px */
@media (max-width: 480px) {

    /* Hero */
    section > .container h1 { font-size: 1.7rem !important; }
    section > .container p  { font-size: 0.95rem !important; }



    /* Category icons */
    .category-circle { width: 58px !important; height: 58px !important; }
    .category-icon span { font-size: 0.72rem !important; width: 65px !important; }

    /* Pagination */
    .pagination { gap: 0.2rem; }
    .pagination a, .pagination span {
        min-width: 32px !important; height: 32px !important;
        font-size: 0.78rem !important; padding: 0 0.4rem !important;
    }

    /* Admin */
}

/* التابلت 481px - 768px */
@media (min-width: 481px) and (max-width: 768px) {

    /* Product grid — 2 cols */
    .product-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.2rem;
    }


    /* Admin */
}

/* اللابتوب الصغير 769px - 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .product-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.2rem;
    }
    .product-card { width: 100% !important; }
}

/* product.php — grid التفاصيل على الهاتف */
@media (max-width: 768px) {
    .product-detail-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== Footer Sticky Fix ===== */
/* كل صفحة لها body flex column في style inline
   هنا نضمن أن footer لا يتقلص أبداً */
footer { flex-shrink: 0; margin-top: auto; }

/* ===== Categories page mobile ===== */
@media (max-width: 600px) {
    .cat-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.6rem !important; }
    .cat-card { padding: 0.75rem 0.5rem !important; }
    .cat-card img { height: 80px !important; object-fit: cover; }
    .cat-card h3, .cat-card .cat-name { font-size: 0.78rem !important; }
}

/* ── Product Card Action Buttons ── */


/* Mobile: stack buttons vertically on very small screens */


