/**
 * General CSS Styles for Quickie Drink Store
 * Path: /assets/css/style.css
 * 
 * This file contains the main styles for the client-facing
 * pages of the Quickie drink delivery application.
 */

/* ========== VARIABLES & RESET ========== */
:root {
    /* Main Colors */
    --primary: #00A7E1;
    --primary-dark: #0086b3;
    --primary-light: #e6f7fd;
    --secondary: #003B5C;
    --accent: #00d569; /* Green accent color */
    --accent-light: #e3ffef;

    /* Text Colors */
    --text-dark: #333333;
    --text-gray: #666666;
    --text-light: #999999;

    /* UI Colors */
    --border-color: #eeeeee;
    --background: #f8f9fa;
    --danger: #ff3b30;
    --success: #34c759;
    --warning: #ffcc00;

    /* Shadows & Effects */
    --card-shadow: 0 3px 8px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 8px 15px rgba(0,0,0,0.12);
    --btn-shadow: 0 2px 5px rgba(0,0,0,0.1);
    --transition: all 0.2s ease;

    /* Radius */
    --border-radius-sm: 6px;
    --border-radius: 12px;
    --border-radius-lg: 16px;

    /* iOS Safe Areas for Notch Support */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background);
    color: var(--text-dark);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    /* Enhanced mobile scrolling */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    /* Prevent zoom on double tap */
    touch-action: manipulation;
    /* iOS Safe Area Support */
    padding-top: var(--safe-area-inset-top);
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
    padding-bottom: var(--safe-area-inset-bottom);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    font-weight: 600;
    color: var(--text-dark);
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

/* ========== LAYOUT & CONTAINERS ========== */
.app-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 25px 0 15px;
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-dark);
    position: relative;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 30px;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px;
}

.view-all {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.view-all:hover {
    background-color: var(--primary-light);
}

.empty-state {
    text-align: center;
    padding: 30px 0;
    color: var(--text-light);
}

/* ========== SEARCH & HEADER ========== */
.search-container {
    padding: 20px 20px;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    z-index: 1000;
    /* iOS Safe Area Support for header */
    padding-top: calc(20px + var(--safe-area-inset-top));
    padding-left: calc(20px + var(--safe-area-inset-left));
    padding-right: calc(20px + var(--safe-area-inset-right));
}

.search-bar {
    background-color: var(--background);
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.search-bar:active {
    transform: scale(0.98);
}

.search-bar i {
    color: var(--text-light);
    margin-right: 10px;
}

.search-input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 0.95rem;
    color: var(--text-dark);
    cursor: pointer;
}

.search-input::placeholder {
    color: var(--text-gray);
}

.search-results-container {
    position: absolute;
    left: 0;
    right: 0;
    background-color: white;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-radius: 0 0 12px 12px;
    display: none;
    padding: 15px;
}

.search-result-item {
    display: flex;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-dark);
}

.search-result-img {
    width: 50px;
    height: 50px;
    background-color: var(--background);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.search-result-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.search-result-price {
    color: var(--primary);
    font-weight: 600;
}

/* Page header (for internal pages) */
.page-header {
    padding: 20px 20px;
    background-color: white;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    /* iOS Safe Area Support for page header */
    padding-top: calc(20px + var(--safe-area-inset-top));
    padding-left: calc(20px + var(--safe-area-inset-left));
    padding-right: calc(20px + var(--safe-area-inset-right));
}

.back-button {
    margin-right: 15px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    text-decoration: none;
    background-color: var(--background);
    border-radius: 50%;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-dark);
    flex: 1;
}

/* ========== CATEGORIES & BRANDS ========== */
.categories-scrollable {
    overflow-x: auto;
    white-space: nowrap;
    padding: 15px 0;
    margin: 0 -10px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
}

.categories-scrollable::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Webkit */
}

.categories-container {
    display: inline-flex;
    padding: 0 10px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 24px;
    text-decoration: none;
    color: var(--text-dark);
    width: 72px;
    transition: transform 0.2s ease;
}

.category-item:hover {
    transform: translateY(-3px);
}

.category-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.category-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 50%);
    z-index: 1;
}

.category-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.category-icon i {
    font-size: 1.5rem;
    z-index: 2;
}

.category-text {
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.category-name {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    margin-top: 5px;
    color: var(--text-dark);
    display: block;
    width: 100%;
    white-space: normal;
    overflow: visible;
    line-height: 1.2;
    height: auto;
    min-height: 28px;
}

.category-type {
    font-size: 10px;
    color: var(--text-gray);
    text-align: center;
    margin-top: 1px;
    display: block;
    width: 100%;
    line-height: 1.2;
}

/* Brand specific styling */
.brand-item {
    width: 85px;
}

.brand-item .category-icon {
    border-radius: 12px;
    background-color: white;
    position: relative;
    overflow: hidden;
}

.brand-letter {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    position: relative;
    z-index: 2;
}

.brand-item .category-name {
    font-size: 11px;
    font-weight: 600;
}

.brand-item .category-type {
    font-size: 10px;
    opacity: 0.8;
}

.brand-item .category-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 0;
    position: absolute;
    top: 0;
    left: 0;
}

.brand-item .category-icon.letter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== PRODUCT CARDS ========== */
.products-scrollable {
    overflow-x: auto;
    white-space: nowrap;
    margin: 0 -10px;
    padding: 5px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.products-scrollable::-webkit-scrollbar {
    display: none;
}

.products-container {
    display: inline-flex;
    padding: 0 10px;
}

.product-card-final {
    position: relative;
    width: 170px;
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    margin-right: 15px;
    box-shadow: var(--card-shadow);
    display: inline-block;
    white-space: normal;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 310px;
}

.product-card-final:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.product-link-final {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    width: 100%;
}

.discount-badge-final {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--danger);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    z-index: 5;
}

.product-image-final {
    width: 100%;
    height: 170px;
    background-color: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image-final img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card-final:hover .product-image-final img {
    transform: scale(1.05);
}

.product-info-final {
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 140px;
    justify-content: space-between;
}

.product-volume-final {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
    align-self: flex-start;
}

.product-name-final {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 2.6em;
    max-height: 2.6em;
    flex-grow: 1;
}

.product-pricing-final {
    margin-top: auto;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
}

.current-price-final {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--primary);
    margin-right: 8px;
}

.original-price-final {
    font-size: 0.85rem;
    text-decoration: line-through;
    color: var(--text-light);
    display: inline-block;
}

.add-to-cart-btn-final {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--accent);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transition: transform 0.2s, background-color 0.2s;
    z-index: 10;
}

.add-to-cart-btn-final:hover {
    transform: scale(1.1);
    background-color: #00c060;
}

.add-to-cart-btn-final:active {
    transform: scale(0.95);
}

/* ========== FOOTER & NAVIGATION ========== */
.app-footer {
    display: block;
}

.mobile-menu-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 5px 5px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    /* iOS Safe Area Support for bottom navigation */
    padding-bottom: calc(5px + var(--safe-area-inset-bottom));
    padding-left: calc(5px + var(--safe-area-inset-left));
    padding-right: calc(5px + var(--safe-area-inset-right));
}

.menu-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #AAAAAA;
    font-size: 0.7rem;
    position: relative;
    padding: 6px 0;
}

.menu-tab i {
    font-size: 1.4rem;
    margin-bottom: 3px;
}

.menu-tab.active {
    color: var(--primary);
}

.menu-tab .cart-badge {
    position: absolute;
    top: 0;
    right: 50%;
    margin-right: -20px;
    background-color: var(--danger);
    color: white;
    font-size: 0.7rem;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* ========== FORM ELEMENTS ========== */
.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-dark);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 0.25rem var(--primary-light);
}

.form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    cursor: pointer;
}

.btn-primary {
    color: #fff;
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-success {
    color: #fff;
    background-color: var(--success);
    border-color: var(--success);
}

.btn-danger {
    color: #fff;
    background-color: var(--danger);
    border-color: var(--danger);
}

.btn-block {
    display: block;
    width: 100%;
}

/* ========== UTILITY COMPONENTS ========== */
.age-verification-banner {
    display: flex;
    align-items: center;
    background-color: var(--primary-light);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    margin-top: 20px;
}

.age-icon {
    width: 40px;
    height: 40px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
    margin-right: 15px;
    flex-shrink: 0;
}

.age-text p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--primary-dark);
    line-height: 1.4;
}

/* Alert/Flash messages */
.flash-container {
    padding: 15px 20px;
}

.flash-alert {
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
}

.flash-alert.success {
    background-color: var(--success);
    color: white;
}

.flash-alert.danger {
    background-color: var(--danger);
    color: white;
}

.flash-alert.warning {
    background-color: var(--warning);
    color: #333;
}

.flash-alert.info {
    background-color: var(--primary);
    color: white;
}

.alert-close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: inherit;
    opacity: 0.8;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

/* ========== GRID SYSTEM ========== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
}

.col {
    position: relative;
    width: 100%;
    padding-right: 10px;
    padding-left: 10px;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

/* ========== RESPONSIVE MEDIA QUERIES ========== */
/* Small devices (landscape phones) */
@media (min-width: 576px) {
    .col-sm-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-sm-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/* Medium devices (tablets) */
@media (min-width: 768px) {
    .app-container {
        max-width: 720px;
    }
    
    .search-container, .page-header {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
        border-radius: 8px;
        margin-top: 15px;
    }
    
    .flash-container {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .search-results-container {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 8px;
        margin-top: 5px;
    }
    
    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
    
    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* Large devices (desktops) */
@media (min-width: 992px) {
    .app-container {
        max-width: 960px;
    }
    
    .app-footer {
        display: none;
    }
    
    body {
        padding-bottom: 0;
    }
    
    .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    
    .col-lg-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }
}

/* Extra large devices */
@media (min-width: 1200px) {
    .app-container {
        max-width: 1140px;
    }
}

/* Mobile-specific adjustments */
@media (max-width: 575.98px) {
    .product-card-final {
        width: 155px;
        height: 315px;
    }
    
    .product-image-final {
        height: 150px;
    }
    
    .product-volume-final {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
    
    .product-name-final {
        font-size: 0.9rem;
    }
    
    .current-price-final {
        font-size: 1rem;
    }
}