/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    direction: rtl;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
   
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #27aea0, #36B492);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 16px;
    text-align: center;
}

.search-bar {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-bar i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.search-bar input {
    width: 100%;
    padding: 12px 45px 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Detail Header Styles */
.detail-header {
    background: transparent;
    color: white;
    padding: 15px 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* Hide header except back button on mobile */
@media (max-width: 768px) {
    .detail-header {
        background: transparent;
        /* position: fixed; */
        top: 20px;
        padding: 0;
    }
    
    .detail-header .container {
        padding: 0 20px;
    }
    
    .detail-header h1 {
        display: none;
    }
    
    .favorite-btn {
        display: none;
    }
    
    .back-btn {
        background: rgba(0,0,0,0.3);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255,255,255,0.2);
    }
}

.detail-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-btn, .favorite-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.back-btn:hover, .favorite-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.detail-header h1 {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    flex: 1;
}

/* Main Content */
.main {
    padding: 20px 0;
    min-height: calc(100vh - 120px);
}

.detail-main {
    padding: 0;
    min-height: calc(100vh - 80px);
}

/* Loading States */
.loading-state {
    padding: 20px 0;
}

.shimmer-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.shimmer-card {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    height: 140px;
    border-radius: 12px;
}

.detail-shimmer {
    padding: 20px;
}

.shimmer-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
    margin-bottom: 20px;
}

.shimmer-info {
    width: 80%;
    height: 100px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 20px;
}

.shimmer-tabs {
    width: 100%;
    height: 50px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 20px;
}

.shimmer-menu {
    width: 100%;
    height: 300px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Error and Empty States */
.error-state, .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.error-state i, .empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #999;
}

.error-state h3, .empty-state h3 {
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

.retry-btn {
    background: #27aea0;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: #36B492;
    transform: translateY(-2px);
}

/* Restaurant Grid */
.restaurants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* Restaurant Card */
.restaurant-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.restaurant-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.restaurant-image {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.restaurant-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.restaurant-card:hover .restaurant-image img {
    transform: scale(1.05);
}

.favorite-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.favorite-btn:hover {
    background: white;
    transform: scale(1.1);
}

.favorite-btn.active i {
    color: #e74c3c;
}

.restaurant-info {
    padding: 16px;
}

.restaurant-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #2c3e50;
}

.restaurant-description {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.restaurant-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}



.distance {
    font-size: 12px;
    color: #27aea0;
    font-weight: 600;
}

/* Restaurant Detail Page */
.restaurant-info-section {
    background: white;
    padding: 20px 0;
}

.restaurant-header {
    display: flex;
    gap: 20px;
    align-items: start;
}

.restaurant-image-large {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.restaurant-image-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mobile Restaurant Header - Full Cover Image */
@media (max-width: 768px) {
    .restaurant-info-section {
        padding: 0;
        margin: 0;
        position: relative;
    }
    
    .restaurant-header {
        position: relative;
        height: 250px;
        margin: 0;
        padding: 0;
    }
    
    .restaurant-image-large {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        /* height: 250px; */
        border-radius: 0;
        z-index: 1;
    }
    
    .restaurant-image-large img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }
    
    .restaurant-image-large::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
        z-index: 2;
    }
    
    .restaurant-details {
        position: absolute;
        bottom: 10px;
        left: 16px;
        right: 16px;
        /* padding: 20px; */
        /* background: white; */
        border-radius: 20px 20px 0 0;
        z-index: 10;
        /* box-shadow: 0 -2px 10px rgba(0,0,0,0.1); */
    }
    
    .restaurant-details h1 {
        color: white !important;
        text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    }
    
    .restaurant-details p {
        color: white !important;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    }
    
    .menu-section {
        margin-top: 100px;
    }
}

.restaurant-details {
    flex: 1;
}

.restaurant-details h1 {
    font-size: 24px;
    font-weight: 800;
    color: #2c3e50;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.restaurant-details p {
    font-size: 16px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.restaurant-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.restaurant-rating .stars {
    font-size: 16px;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.contact-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #27aea0;
    color: white;
}

.contact-btn:hover {
    background: #36B492;
    transform: translateY(-1px);
}

/* Menu Section */
.menu-section {
    background: white;
    margin-top: 10px;
    padding: 20px 0;
}

.menu-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: white;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
    padding-top: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.menu-tabs::-webkit-scrollbar {
    display: none;
}

.menu-tab {
    background: #f8f9fa;
    color: #666;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
}

.menu-tab.active {
    background: #27aea0;
    color: white;
}

.menu-tab:hover {
    background: #e9ecef;
}

.menu-tab.active:hover {
    background: #36B492;
}



.menu-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.menu-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-color: #27aea0;
}

.menu-item-info {
    flex: 1;
    max-width: calc(100% - 100px) !important;
    overflow: hidden;
}

.item-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #2c3e50;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.item-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.item-price {
    font-size: 18px;
    font-weight: 700;
    color: #27aea0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.menu-item-image {
    width: 80px !important;
    height: 80px !important;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0 !important;
    position: relative;
}

.menu-item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Add to cart button */
.add-to-cart-btn {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    background: #27aea0;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    flex: 0 0 auto;
    align-self: flex-start;
}
.add-to-cart-btn:hover { background: #36B492; }

/* Shake animation for floating cart */
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}
.floating-cart.shake {
    animation: shake 0.6s cubic-bezier(.36,.07,.19,.97) both;
}

/* Floating cart */
.floating-cart {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #27aea0;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1001;
}
.floating-cart i { font-size: 20px; }
.cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    background: #e74c3c;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 0 6px;
    font-weight: 800;
}

/* Cart rows inside modal */
.cart-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
}
.cart-row-left { display: flex; gap: 10px; align-items: flex-start; }
.cart-thumb { width: 54px; height: 54px; border-radius: 8px; overflow: hidden; background: #f3f3f3; flex-shrink: 0; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-info { max-width: 220px; }
.cart-row-name { font-weight: 700; color: #2c3e50; }
.cart-row-desc { font-size: 12px; color: #666; margin-top: 4px; }
.cart-row-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    background: #fff;
    cursor: pointer;
}
.remove-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: #e74c3c;
    color: #fff;
    cursor: pointer;
}

/* Typography enforcement for new UI */
.add-to-cart-btn,
.floating-cart,
.modal .modal-content,
.modal input,
.modal textarea,
.modal button,
.cart-row { font-family: 'Tajawal', sans-serif; }

.small-note { font-family: 'Tajawal', sans-serif; }

/* Mobile Menu Items - Side by Side Layout */
@media (max-width: 768px) {
    .menu-item {
        padding: 12px;
        gap: 12px;
        margin: 0 5px 8px 5px;
    }
    
    .menu-item-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .item-name {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .item-description {
        font-size: 16px;
        margin-bottom: 8px;
        flex: 1;
    }
    
    .item-price {
        font-size: 18px;
        margin-top: auto;
    }
    
    .menu-item-image {
        width: 75px;
        height: 75px;
        order: 2;
    }
}



/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
   
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #666;
}

.modal-body {
    padding: 20px;
}

/* Contact Info */
.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.contact-item:hover {
    background: #f8f9fa;
    border-color: #27aea0;
}

.contact-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.contact-item.phone {
    border-color: #28a745;
    background: #f8fff9;
}

.contact-item.phone i {
    color: #28a745;
}

.contact-item.whatsapp {
    border-color: #25d366;
    background: #f0fff4;
}

.contact-item.whatsapp i {
    color: #25d366;
}

.contact-item.location {
    border-color: #007bff;
    background: #f8f9ff;
}

.contact-item.location i {
    color: #007bff;
}



/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 24px;
    }
    
    .restaurants-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .restaurant-header {
        flex-direction: column;
        text-align: start;
    }
    
    .restaurant-image-large {
        width: 100%;
      
        height: 250px;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        /* padding: 0 12px; */
    }
    
    .header {
        padding: 15px 0;
    }
    
    .restaurant-card {
        margin: 0 -4px;
    }
    
    .restaurant-info {
        padding: 12px;
    }
    
    .restaurant-name {
        font-size: 16px;
    }
    
    .restaurant-description {
        font-size: 13px;
    }
}

/* Text wrapping utility for all text elements */
.contact-item span, 
.restaurant-details *, 
.menu-item-info *,
h1, h2, h3, h4, p, span, div {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    max-width: 100% !important;
    hyphens: auto !important;
    word-break: break-word !important;
}

/* Specific text length control - break after ~60 characters */
.item-name, .item-description, .restaurant-details h1, .restaurant-details p, .contact-item span {
    max-width: 35ch !important;
    word-break: break-word !important;
    hyphens: auto !important;
}

/* Additional utility classes */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}



/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
