/* Custom styles for the restaurant menu system */

/* Theme CSS Variables (can be overridden dynamically) */
:root {
    --theme-bg: #ffffff;
    --theme-text: #1f2937;
    --theme-accent: #f97316;
    --theme-cta: #f97316;
    --theme-font: system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--theme-bg);
    color: var(--theme-text);
    font-family: var(--theme-font);
}

/* Apply theme colors to key elements */
.bg-orange-600, .bg-orange-500, .text-orange-600, .border-orange-300 {
    /* These will be styled with theme accent color dynamically */
}

/* Smooth transitions */
* {
    transition: all 0.2s ease-in-out;
}

/* Line clamp utilities */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Custom button hover effects */
.btn-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Form focus styles */
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

/* Restaurant card hover effect */
.restaurant-card {
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Menu item card animations */
.menu-item-card {
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s ease forwards;
}

.menu-item-card:nth-child(1) { animation-delay: 0.1s; }
.menu-item-card:nth-child(2) { animation-delay: 0.2s; }
.menu-item-card:nth-child(3) { animation-delay: 0.3s; }
.menu-item-card:nth-child(4) { animation-delay: 0.4s; }
.menu-item-card:nth-child(5) { animation-delay: 0.5s; }
.menu-item-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.available {
    background-color: #dcfce7;
    color: #166534;
}

.status-badge.unavailable {
    background-color: #fef2f2;
    color: #dc2626;
}

/* Modal animations */
.modal-backdrop {
    animation: fadeIn 0.3s ease;
}

.modal-backdrop > div {
    animation: slideInDown 0.3s ease;
}

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

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

/* Admin dashboard specific styles */
.nav-item.active {
    border-bottom-color: #f97316 !important;
    color: #f97316 !important;
}

.table-hover tbody tr:hover {
    background-color: #f9fafb;
}

/* Responsive design improvements */
@media (max-width: 768px) {
    .restaurant-card {
        margin-bottom: 1rem;
    }
    
    .menu-item-card {
        margin-bottom: 1rem;
    }
    
    /* Stack navigation on mobile */
    .nav-mobile {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-mobile button {
        width: 100%;
        text-align: left;
        padding: 0.75rem 0;
        border-bottom: 1px solid #e5e7eb;
    }
    
    /* Horizontal scroll for admin tables on mobile */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #cbd5e0 #f7fafc;
    }
    
    .overflow-x-auto::-webkit-scrollbar {
        height: 6px;
    }
    
    .overflow-x-auto::-webkit-scrollbar-track {
        background: #f7fafc;
    }
    
    .overflow-x-auto::-webkit-scrollbar-thumb {
        background: #cbd5e0;
        border-radius: 3px;
    }
    
    .overflow-x-auto::-webkit-scrollbar-thumb:hover {
        background: #a0aec0;
    }
}

/* Admin menu navigation horizontal scroll optimization */
.admin-menu-nav {
    /* Hide scrollbars but allow scrolling */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.admin-menu-nav::-webkit-scrollbar {
    display: none;
}

/* Menu navigation buttons should not wrap */
.admin-menu-nav nav {
    min-width: fit-content;
}

.admin-menu-nav nav button {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Sale price styles */
.sale-badge {
    animation: saleGlow 2s ease-in-out infinite alternate;
}

@keyframes saleGlow {
    from {
        box-shadow: 0 0 5px rgba(220, 38, 38, 0.3);
    }
    to {
        box-shadow: 0 0 15px rgba(220, 38, 38, 0.6);
    }
}

.price-container {
    min-width: 80px;
}

/* Strikethrough price animation */
.line-through {
    position: relative;
    text-decoration: none !important;
}

.line-through::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    animation: strikethrough 0.5s ease-out 0.5s forwards;
}

@keyframes strikethrough {
    to {
        transform: scaleX(1);
    }
}

/* Restaurant table description scroll styles */
.restaurant-description-scroll {
    max-width: 300px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
}

.restaurant-description-scroll::-webkit-scrollbar {
    height: 4px;
}

.restaurant-description-scroll::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 2px;
}

.restaurant-description-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.restaurant-description-scroll::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Category drag and drop improvements */
.category-item {
    user-select: none;
}

.category-item button {
    pointer-events: auto;
    z-index: 10;
    position: relative;
}

.category-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

/* Subscription status improvements */
.subscription-dates {
    font-size: 0.75rem;
    line-height: 1rem;
}

.days-left {
    font-weight: 600;
}

/* Vertical photo layout styles */
.menu-item-card.vertical-photo-layout {
    /* Enhanced styling for vertical photos like bottles */
}

.menu-item-card.vertical-photo-layout .menu-item-image-container {
    background: linear-gradient(to bottom, #f9fafb, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.menu-item-card.vertical-photo-layout .menu-item-image-container img {
    max-height: 400px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Responsive adjustments for vertical photos */
@media (max-width: 640px) {
    .menu-item-card.vertical-photo-layout .menu-item-image-container {
        max-height: 300px;
        padding: 0.5rem;
    }
    
    .menu-item-card.vertical-photo-layout .menu-item-image-container img {
        max-height: 300px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .menu-item-card.vertical-photo-layout .menu-item-image-container {
        max-height: 350px;
    }
    
    .menu-item-card.vertical-photo-layout .menu-item-image-container img {
        max-height: 350px;
    }
}

/* Image loading state */
.menu-item-image-container {
    position: relative;
    transition: height 0.3s ease;
}

.menu-item-image-container img {
    transition: opacity 0.3s ease;
}

/* Horizontal layout styles */
.horizontal-item {
    transition: all 0.2s ease-in-out;
}

.horizontal-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.menu-item-thumbnail {
    transition: all 0.3s ease;
    position: relative;
}

.menu-item-thumbnail:hover {
    transform: scale(1.05);
}

.menu-item-thumbnail::after {
    content: '\f002'; /* FontAwesome search icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    color: white;
    font-size: 1.5rem;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    border-radius: 0.5rem;
}

.menu-item-thumbnail:hover::after {
    background: rgba(0, 0, 0, 0.5);
    opacity: 1;
}

.menu-item-thumbnail img {
    transition: opacity 0.3s ease;
}

/* Modal styles */
#item-detail-modal {
    animation: fadeIn 0.3s ease;
}

#item-detail-modal > div {
    animation: slideInUp 0.3s ease;
}

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

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

/* Mobile responsive horizontal layout */
@media (max-width: 640px) {
    .horizontal-item .flex {
        padding: 0.75rem;
    }
    
    .horizontal-item .menu-item-thumbnail img {
        width: 4.5rem;
        height: 4.5rem;
    }
    
    .horizontal-item h3 {
        font-size: 0.875rem;
        line-height: 1.25rem;
    }
    
    .horizontal-item .price-container {
        font-size: 0.875rem;
    }
    
    /* Modal adjustments for mobile */
    #item-detail-modal .max-w-2xl {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    #item-detail-modal img.max-h-96 {
        max-height: 16rem;
    }
}

@media (min-width: 641px) {
    .horizontal-item .menu-item-thumbnail img {
        width: 6rem;
        height: 6rem;
    }
}

/* Enhanced touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
    .horizontal-item:active {
        transform: scale(0.98);
    }
    
    button:active {
        transform: scale(0.95);
    }
}

/* Ensure proper image aspect ratio in modal */
#item-detail-modal img {
    display: block;
    margin: 0 auto;
}

/* Smooth scroll for modal content */
#item-detail-modal > div {
    scroll-behavior: smooth;
}

/* Language selector dropdown optimizations */
.language-dropdown-container {
    position: relative;
    z-index: 100 !important;
}

.language-dropdown {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 100 !important;
}

/* Ensure dropdowns are always on top of sticky navbars */
select {
    position: relative;
    z-index: auto;
}

/* When dropdown is opened, ensure it appears above sticky elements */
select:focus {
    z-index: 101 !important;
}

/* Fix for custom dropdowns and modals to appear above sticky navbars */
.z-\\[100\\] {
    z-index: 100 !important;
}

/* Sticky navigation should be below dropdowns but above content */
.sticky {
    z-index: 40 !important;
}

.language-dropdown .language-option:focus {
    outline: 2px solid #f97316;
    outline-offset: -2px;
    background-color: #fff7ed;
}

.language-option.selected {
    background-color: #fff7ed;
    border-left: 3px solid #f97316;
}

/* Mobile optimizations for language selector */
@media (max-width: 640px) {
    .language-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 1rem 1rem 0 0 !important;
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .language-dropdown .language-option {
        padding: 1rem !important;
        font-size: 1rem !important;
    }
    
    .language-dropdown-container {
        position: static;
    }
}

/* Mobile optimizations for admin forms */
@media (max-width: 768px) {
    /* Stack language fields vertically on mobile */
    .lang-field {
        width: 100% !important;
    }
    
    /* Better spacing for language checkboxes on mobile */
    .language-checkbox + span {
        font-size: 1rem !important;
    }
    
    /* Optimize modal for mobile */
    .modal-backdrop > div {
        max-height: 90vh;
        overflow-y: auto;
        margin: 1rem;
    }
    
    /* Better touch targets for mobile */
    input[type="checkbox"], input[type="radio"] {
        min-width: 1.25rem;
        min-height: 1.25rem;
    }
    
    /* Stack form grid on mobile */
    .grid.grid-cols-2, .grid.grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
    
    /* Better spacing for mobile forms */
    .gap-6 {
        gap: 1rem !important;
    }
    
    .gap-4 {
        gap: 0.75rem !important;
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Two columns for language fields on tablet */
    .grid.lg\\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Enhanced touch feedback */
@media (hover: none) and (pointer: coarse) {
    .language-option:active {
        background-color: #fed7aa !important;
        transform: scale(0.98);
    }
    
    label:has(input[type="checkbox"]):active {
        background-color: #f3f4f6;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .shadow-md, .shadow-lg, .shadow-xl {
        box-shadow: none !important;
    }
}