/* assets/css/sub_style.css */
/* Specific Styles for Category Detail Page + Modal Fixes */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Outfit:wght@300;400;500;600&display=swap');


:root {
    /* Fallback values if JS/PHP injection fails */
    --primary: #000000;
    --accent: #2fb344;
    --bg-color: #ffffff;
    --text-color: #333333;
    --header-bg: #1a1a1a;
}

body.dark-mode {
    --bg-color: #121212 !important;
    --text-color: #e0e0e0 !important;
    --header-bg: #000000 !important;
}

body.dark-mode .p-card {
    background: #1e1e1e !important;
    border: 1px solid #333;
}

body.dark-mode .p-name {
    color: #fff;
}

body.dark-mode .p-desc {
    color: #aaa;
}

body.dark-mode .price-tag {
    color: var(--primary);
    background: #eee;
}

body.dark-mode .scroll-item.active {
    border-bottom-color: #fff !important;
    color: #fff !important;
}

body.dark-mode .back-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: #555;
    color: white !important;
}

body.dark-mode .sub-header {
    background: #1e1e1e !important;
    border-bottom: 1px solid #333;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

body.dark-mode .cat-scroller {
    background: #1e1e1e !important;
    border-bottom: 1px solid #333;
}

body.dark-mode .page-title {
    color: #fff !important;
}

body.dark-mode .scroll-item {
    color: rgba(255, 255, 255, 0.7) !important;
}

body.dark-mode .scroll-item.active {
    color: #fff !important;
    border-bottom-color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
}

/* Modal & Footer Dark Mode */
body.dark-mode .modal-content {
    background: #1e1e1e;
    color: #e0e0e0;
}

body.dark-mode .m_desc_text {
    color: #ccc;
}

body.dark-mode .close-m-btn {
    background: #333;
    color: white;
}

body.dark-mode .premium-footer {
    background: linear-gradient(to bottom, #121212, #000000);
    border-top-color: #333;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

body.dark-mode .footer-text {
    color: #aaa;
}

body.dark-mode .footer-update-info {
    background: rgba(255, 255, 255, 0.05);
    color: #888;
}

body.dark-mode .social-btn {
    background: #1e1e1e;
    color: #fff !important;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    background-color: #f0f2f5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Centered Layout Container */
.app-container {
    max-width: 500px;
    margin: 0 auto;
    background-color: var(--bg-color);
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

body.dark-mode .app-container {
    background-color: var(--bg-color);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* 1. HEADER */
.sub-header {
    background: var(--header-bg);
    color: white;
    /* Always white text on header for now, or could use a var if added */
    padding: 1rem;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height, 60px);
    box-sizing: border-box;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.back-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.back-btn:hover {
    background: white;
    color: var(--header-bg);
}

.page-title {
    font-family: 'Playfair Display', serif;
    /* Will be overridden by inline style */
    font-size: 1.3rem;
    letter-spacing: 0.5px;
    text-align: center;
    flex-grow: 1;
    margin-right: 36px;
    /* Balance the back btn */
    font-weight: 600;
}

/* 2. HORIZONTAL CATEGORY SCROLLER */
.cat-scroller {
    background: var(--header-bg);
    padding: 0;
    white-space: nowrap;
    overflow-x: auto;
    position: sticky;
    top: var(--header-height, 60px);
    z-index: 999;
    -ms-overflow-style: none;
    scrollbar-width: none;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cat-scroller::-webkit-scrollbar {
    display: none;
}

.scroller-inner {
    display: flex;
}

.scroll-item {
    padding: 0.9rem 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.scroll-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 3px solid white;
    /* Will be overridden by inline style var(--primary) */
    font-weight: 600;
}

/* 3. PRODUCT GRID FIXES */
.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 15px;
    align-items: start;
}

.p-card {
    background: var(--bg-color);
    /* Matches body usually, or card color */
    /* If cards need to stand out on a colored background: */
    /* background: #ffffff; */
    border-radius: 12px;
    text-align: left;
    width: 100%;
    overflow: hidden;
    /* Optional shadow */
    /* box-shadow: 0 4px 12px rgba(0,0,0,0.05); */
}

.p-img-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: rgba(0, 0, 0, 0.05);
}

.p-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.p-card:active .p-img {
    transform: scale(1.05);
}

.price-tag {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: white;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
}

.old-price {
    font-size: 0.75rem;
    color: #999;
    text-decoration: line-through;
    margin-bottom: 2px;
    font-weight: 500;
}

.prod-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--badge-bg);
    color: var(--badge-text);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
}

.prod-badge.popular {
    background: var(--popular-bg);
    color: var(--popular-text);
    /* Amber/Orange for star */
}

.p-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 10px 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.p-desc {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.7;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    /* Limit to 1 line */
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    word-break: break-word;
}

/* MODAL FIXED */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    /* Slightly more transparent */
    z-index: 15000;
    /* Ensure it's above floating buttons (9999) */
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    /* More blur for premium feel */
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-scroll-area {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

/* Sticky bottom action bar for Add to Cart */
.modal-action-bar {
    flex-shrink: 0;
    padding: 16px 20px;
    /* More padding */
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.08);
    /* Softer, larger shadow */
    z-index: 10;
}

body.dark-mode .modal-action-bar {
    background: #1a1a1a;
    border-top-color: #333;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

/* Custom Scrollbar for Modal - High Visibility */
.modal-scroll-area::-webkit-scrollbar {
    width: 10px;
}

.modal-scroll-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-scroll-area::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
    border: 1px solid #fff;
}

.modal-scroll-area::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.close-m-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.m_desc_text {
    color: #444;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    font-size: 0.95rem;
    padding: 0 20px;
}

/* Add to Cart Button in Modal */
.add-to-cart-btn {
    width: 100%;
    padding: 14px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

body.dark-mode .add-to-cart-btn {
    background: #fff;
    color: #000;
}

.add-to-cart-btn:active {
    transform: scale(0.98);
}

/* PREMIUM FOOTER (Copied from style.css for Sub-Pages) */
.premium-footer {
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    padding: 40px 20px;
    text-align: center;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: 50px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.03);
}

.footer-social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
}

.social-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    text-decoration: none;
    opacity: 1 !important;
}

.social-btn:visited,
.social-btn:active,
.social-btn:focus,
.social-btn:link {
    color: var(--primary) !important;
    opacity: 1 !important;
}

.social-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
    background: var(--primary-color) !important;
    /* Fallback/Var match */
    background: var(--primary) !important;
    color: white !important;
    opacity: 1 !important;
}

.footer-text {
    font-family: var(--font-restaurant);
    /* Adjusted variable for sub_style */
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 10px;
    font-weight: 500;
}

.footer-update-info {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.03);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
}