/**
 * Index Page Styles
 * Q-Mak Queue Management System
 * Landing/Home Page
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.cdnfonts.com/css/metropolis-2');

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
}

html {
    scroll-behavior: smooth;
}

.font-metropolis {
    font-family: 'Metropolis', sans-serif;
}

/* Hardware-accelerated hover effects */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    will-change: transform;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Mobile menu animation */
.animate-fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Hero background with animated blob */
.hero-background {
    background-image: url('../../../images/UMak-Facade-Admin-2024.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.hero-overlay {
    background: rgba(15, 23, 42, 0.85);  /* Using primary-900 with opacity */
    backdrop-filter: blur(2px);
}

/* Animated blob effect */
.hero-background::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.3) 0%, transparent 70%);  /* Using accent-600 */
    animation: blob 7s ease-in-out infinite;
    will-change: transform;
}

@keyframes blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* Fade-in animation for content */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

/* Modal animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content {
    animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop {
    backdrop-filter: blur(8px);
    transition: backdrop-filter 0.3s ease;
}

/* Gradient text effect */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-900) 0%, var(--accent-600) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-500), var(--accent-700));
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-600), var(--primary-900));
}

/* Logo hover effects */
.logo-hover {
    transition: transform 0.3s ease;
    will-change: transform;
}

.logo-hover:hover {
    transform: scale(1.1);
}

/* Button hover scale */
.btn-hover {
    transition: all 0.3s ease;
    will-change: transform;
}

.btn-hover:hover {
    transform: translateY(-2px) scale(1.02);
}

/* Link icon effects */
.link-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.link-icon:hover {
    transform: scale(1.15) rotate(5deg);
}

/* FAQ Rotation */
.rotate-180 {
    transform: rotate(180deg);
}

/* Mobile bottom navigation - enhanced */
.safe-area-bottom {
    padding-bottom: calc(env(safe-area-inset-bottom) + 4px);
}

/* Enhanced mobile bottom nav buttons */
@media (max-width: 768px) {
    nav.md\:hidden button,
    nav.md\:hidden a {
        position: relative;
        overflow: hidden;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    nav.md\:hidden button:active,
    nav.md\:hidden a:active {
        transform: scale(0.9);
        background-color: rgba(0, 0, 0, 0.05);
    }
    
    nav.md\:hidden button i,
    nav.md\:hidden a i {
        transition: transform 0.2s;
    }
    
    nav.md\:hidden button:active i,
    nav.md\:hidden a:active i {
        transform: scale(1.1);
    }
}

/* Bounce animation for floating button */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-bounce-slow {
    animation: bounce 2s infinite;
}

/* Floating order button - lower opacity */
.floating-order-btn {
    opacity: 0.85;
    box-shadow: 
        0 10px 30px rgba(30, 58, 138, 0.5),
        0 20px 50px rgba(0, 0, 0, 0.3);
}

.floating-order-btn:hover {
    opacity: 0.95;
    box-shadow: 
        0 15px 40px rgba(30, 58, 138, 0.6),
        0 25px 60px rgba(0, 0, 0, 0.4);
}

/* Fade in up animation for sections */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Carousel arrows - lower opacity */
.carousel-arrow {
    opacity: 0.85;
}

.carousel-arrow:hover {
    opacity: 0.95;
}

/* Skeleton loader for status cards */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(
        to right,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 1000px 100%;
}

/* Improved touch feedback for all interactive elements */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.touch-feedback:active::after {
    width: 200px;
    height: 200px;
}

/* Enhanced button states for mobile */
button, a[role="button"] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button:active, a[role="button"]:active {
    transform: scale(0.97);
    transition: transform 0.1s;
}

/* Smooth scroll with offset for fixed header */
html {
    scroll-padding-top: 80px;
}

/* Mobile optimization */
@media (max-width: 768px) {
    body {
        padding-bottom: 80px; /* Increased space for bottom nav */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .hero-background {
        min-height: 450px; /* Optimized height for better content visibility */
        padding-top: 5rem;
        padding-bottom: 3rem;
        touch-action: pan-y; /* Enable vertical scrolling only */
    }

    .hero-background .max-w-7xl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .hero-background h1 {
        font-size: 2.25rem; /* Improved readability */
        margin-bottom: 1rem;
        line-height: 1.2;
        letter-spacing: -0.02em;
    }

    .hero-background p {
        font-size: 1rem; /* Better readability */
        margin-bottom: 1.5rem;
        line-height: 1.5;
    }

    .hero-background .flex-wrap > * {
        flex: 1 1 100%; /* Stack buttons on mobile */
    }

    /* Trust badges within hero section */
    .hero-background .flex-wrap.gap-3 > div {
        padding: 0.5rem 0.75rem; /* Smaller padding for badges */
        font-size: 0.75rem; /* Smaller text for badges (text-xs) */
    }

    /* CTA buttons within hero section - enhanced for mobile */
    .hero-background .flex-wrap.gap-3 button, .hero-background .flex-wrap.gap-3 a {
        padding: 1rem 1.5rem; /* Larger touch targets (min 44px) */
        font-size: 1.125rem;
        min-height: 48px; /* WCAG AAA touch target size */
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(8px);
    }
    
    .hero-background .flex-wrap.gap-3 button:active, 
    .hero-background .flex-wrap.gap-3 a:active {
        transform: scale(0.95);
    }

    /* Carousel mobile adjustments */
    #about {
        padding-top: 2rem;
        padding-bottom: 2rem;
        overflow: hidden; /* Ensure content is clipped */
    }
    
    #about .relative.overflow-hidden {
        overflow: visible; /* Allow carousel arrows to display outside of main carousel */
    }

    /* Carousel wrapper - optimized for touch */
    #about #carouselWrapper {
        width: auto;
        overflow: visible;
        cursor: grab;
    }
    
    #about #carouselWrapper:active {
        cursor: grabbing;
    }

    /* Force each slide to match the viewport width to avoid partial swipes */
    #carouselWrapper {
        will-change: transform;
        transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    #carouselWrapper > div {
        width: 100% !important;
        box-sizing: border-box;
        padding-left: 0 !important;
        padding-right: 0 !important;
        flex-shrink: 0;
    }

    #about .min-h-\[400px\], #about .flex-shrink-0 {
        min-height: 400px; /* Fixed height for consistent slides */
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
        display: flex;
        flex-direction: column;
    }
    
    /* Ensure carousel slides have equal heights */
    #carouselWrapper > div {
        min-height: 400px !important;
        display: flex;
        flex-direction: column;
    }
    
    /* Make inner content containers flex to fill space */
    #carouselWrapper > div > .max-w-7xl {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    #about .px-4 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    #about h2 {
        font-size: 1.75rem; /* Reduced font size for section headings */
        margin-bottom: 1rem;
    }

    #about .mb-6 {
        margin-bottom: 1rem;
    }

    #about .p-4 {
        padding: 0.75rem; /* Reduced padding for inner cards */
    }

    #about .gap-3 {
        gap: 0.75rem;
    }
    
    /* Make About UMak Experience card vertical on mobile */
    #about .bg-white.rounded-2xl.shadow-xl.p-4 {
        display: flex;
        flex-direction: column;
        min-height: 120px;
    }
    
    #about .bg-white.rounded-2xl.shadow-xl.p-4 h3 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem;
    }
    
    #about .bg-white.rounded-2xl.shadow-xl.p-4 p {
        font-size: 0.875rem !important;
        line-height: 1.4;
    }
    
    /* Limit dashboard cards from creating excessive height */
    #about .bg-gradient-to-br.rounded-3xl {
        margin-bottom: 0 !important;
    }
    
    #about .grid.lg\:grid-cols-3 {
        align-items: stretch;
    }

    #about .w-8, #about .h-8 {
        width: 24px;
        height: 24px;
    }

    #about .w-10, #about .h-10 {
        width: 32px;
        height: 32px;
    }

    #about .text-lg {
        font-size: 0.9rem;
    }

    #about .text-base {
        font-size: 0.8rem;
    }

    .carousel-arrow {
        top: 50%;
        transform: translateY(-50%);
        width: 32px; /* Smaller arrows */
        height: 32px; /* Smaller arrows */
        padding: 0.375rem; /* Smaller padding */
        left: 0.5rem; /* Adjust position */
        right: 0.5rem;
        z-index: 30; /* Ensure arrows are above content */
    }

    /* Hide arrows on small screens; dots + swipe only */
    .carousel-arrow { display: none !important; }

    .carousel-arrow.left-4 {
        left: 0.5rem;
    }

    .carousel-arrow.right-4 {
        right: 0.5rem;
    }

    .carousel-arrow i {
        font-size: 0.9rem; /* Smaller icon */
    }

    /* Smaller dots */
    .carousel-dot > div {
        width: 10px;
        height: 10px;
    }

    /* Reduce dots bar vertical padding on mobile */
    #carouselDots {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
        margin-top: auto; /* Push to bottom */
    }
    
    /* Fix carousel section to have no extra bottom space */
    #about {
        margin-bottom: 0 !important;
    }
    
    #about > .relative.overflow-hidden {
        margin-bottom: 0 !important;
    }

    /* "How It Works" section adjustments */
    #how-it-works {
        padding-top: 2.25rem; /* Further reduced top padding */
        padding-bottom: 2.25rem; /* Further reduced bottom padding */
    }

    #how-it-works .mb-10 {
        margin-bottom: 1.25rem; /* Further reduced margin */
    }

    #how-it-works h2 {
        font-size: 1.75rem; /* Smaller heading */
        margin-bottom: 0.5rem;
    }

    #how-it-works p {
        font-size: 0.95rem; /* Smaller paragraph text */
    }

    #how-it-works .gap-6 {
        gap: 0.75rem; /* Further reduced gap between steps */
    }

    #how-it-works .p-6 {
        padding: 0.75rem; /* Further reduced padding for step cards */
    }

    /* Further compact step cards on smaller phones */
    #how-it-works .rounded-3xl.p-6, #how-it-works .p-6 {
        padding: 0.5rem !important;
    }

    #how-it-works .w-20, #how-it-works .h-20 {
        width: 40px !important;
        height: 40px !important;
    }

    #how-it-works h3, #how-it-works .text-3xl {
        font-size: 1rem !important;
    }

    #how-it-works .w-10, #how-it-works .h-10 {
        width: 28px;
        height: 28px;
    }

    #how-it-works .text-xl {
        font-size: 0.9rem;
    }

    #how-it-works .w-20, #how-it-works .h-20 {
        width: 40px;
        height: 40px;
    }

    #how-it-works .text-3xl {
        font-size: 1rem;
    }

    #how-it-works .text-lg, #how-it-works .text-base {
        font-size: 0.8rem;
    }

    #how-it-works .mt-4 {
        margin-top: 0.5rem;
    }

    #how-it-works .space-y-1\.5 > li {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    /* Center the stepper vertically next to the heading on desktop-first layout (mobile inherits) */
    .hiw-left .hiw-steps { justify-content: center; }

    /* Features Banner: shrink icons and labels on mobile */
    .bg-primary-900.border-t-4 .flex.items-center.gap-3 .bi {
        font-size: 1.125rem; /* ~text-lg */
    }
    .bg-primary-900.border-t-4 .flex.items-center.gap-3 span {
        font-size: 0.95rem; /* slightly smaller label */
    }

    /* How It Works CTA compaction */
    #how-it-works .text-center > .inline-block {
        padding: 1rem; /* reduce CTA card padding */
        border-radius: 1rem;
    }
    #how-it-works .text-center button {
        padding: 0.75rem 1rem; /* smaller CTA button */
        font-size: 1rem;
        border-radius: 0.75rem;
    }
    #how-it-works .text-center p.text-lg {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    /* COOP Order Modal - enhanced mobile experience */
    #orderModal .modal-content,
    #loginModal .modal-content {
        padding: 1.25rem;
        width: 92vw;
        max-width: 440px;
        max-height: 85vh;
        overflow-y: auto;
        border-radius: 1.5rem;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Modal buttons - better touch targets */
    #orderModal button,
    #loginModal button {
        min-height: 48px;
        transition: all 0.2s;
    }
    
    #orderModal button:active,
    #loginModal button:active {
        transform: scale(0.97);
    }

    #orderModal .mb-8 {
        margin-bottom: 1rem;
    }

    #orderModal h3 {
        font-size: 1.5rem; /* Smaller heading */
    }

    #orderModal p {
        font-size: 0.875rem;
    }

    #orderModal .p-5 {
        padding: 0.75rem; /* Smaller padding for status display */
    }

    #orderModal .gap-6 {
        gap: 1rem;
    }

    #orderModal .p-8 {
        padding: 1rem; /* Smaller padding for buttons */
    }

    #orderModal .w-16, #orderModal .h-16 {
        width: 48px;
        height: 48px;
    }

    #orderModal .text-2xl, #orderModal .text-3xl {
        font-size: 1.25rem;
    }

    #orderModal .text-base {
        font-size: 0.875rem;
    }

    #orderModal .text-sm {
        font-size: 0.75rem;
    }
    
    /* FAQ Section - Mobile Enhancements */
    #faqList .bg-white {
        border-radius: 1rem;
        margin-bottom: 0.75rem;
    }
    
    #faqList button {
        min-height: 56px; /* Larger tap target */
        padding: 1rem;
        font-size: 1rem;
    }
    
    #faqList button:active {
        background-color: rgba(0, 0, 0, 0.02);
    }
    
    /* Search box mobile optimization */
    #faqSearch {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
        border-radius: 0.875rem;
    }
    
    /* Contact section - better mobile spacing */
    #contact .grid {
        gap: 1rem;
    }
    
    #contact .p-8 {
        padding: 1.25rem;
    }
    
    #contact h3 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* Footer mobile optimization */
    footer {
        padding: 2rem 1rem;
    }
    
    footer .h-24 {
        height: 4rem;
    }
    
    footer .gap-8 {
        gap: 1.5rem;
    }
    
    footer .text-3xl {
        font-size: 1.5rem;
    }
}

/* Enhanced animations for mobile */
@media (max-width: 768px) {
    /* Reduce motion for users who prefer it */
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
    
    /* Optimize animations for mobile performance */
    .animate-fade-in,
    .fade-in-up,
    .hover-lift {
        animation-duration: 0.3s;
    }
}

/* Pull-to-refresh prevention for mobile browsers */
body {
    overscroll-behavior-y: contain;
}

/* Improved focus states for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--accent-500);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Loading skeleton for better perceived performance */
.skeleton-pulse {
    animation: skeleton-pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Mobile-specific utility classes */
@media (max-width: 768px) {
    /* Text size adjustments for better readability */
    .mobile-text-base {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .mobile-text-lg {
        font-size: 1.125rem;
        line-height: 1.5;
    }
    
    .mobile-text-xl {
        font-size: 1.25rem;
        line-height: 1.4;
    }
    
    /* Improved spacing for mobile */
    .mobile-space-y-4 > * + * {
        margin-top: 1rem;
    }
    
    .mobile-gap-4 {
        gap: 1rem;
    }
    
    /* Touch-optimized button sizes */
    .mobile-btn {
        min-height: 48px;
        min-width: 48px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Card optimizations */
    .mobile-card {
        border-radius: 1rem;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Sticky header adjustment */
    header.fixed {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(12px);
    }
    
    /* Modal improvements */
    .mobile-modal {
        border-radius: 1.5rem 1.5rem 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Improved form inputs for mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
        border-radius: 0.75rem;
    }
    
    /* Better card hover states for mobile */
    .mobile-card-hover {
        transition: transform 0.2s, box-shadow 0.2s;
    }
    
    .mobile-card-hover:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* Progressive Web App optimizations */
@media (display-mode: standalone) {
    /* PWA specific styles */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    header {
        padding-top: env(safe-area-inset-top);
    }
}

/* Dark mode support for mobile */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    /* Optional: Add dark mode styles for mobile if needed */
    body {
        background-color: #0f172a;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    button,
    a {
        border: 2px solid currentColor;
    }
    
    .gradient-text {
        -webkit-text-fill-color: currentColor;
        background: none;
    }
}

/* Landscape orientation optimizations for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-background {
        min-height: 350px;
        padding-top: 3rem;
        padding-bottom: 2rem;
    }
    
    .hero-background h1 {
        font-size: 1.875rem;
    }
    
    .hero-background p {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    /* Compact bottom navigation in landscape */
    nav.md\:hidden {
        height: 56px;
    }
    
    nav.md\:hidden i {
        font-size: 1.25rem;
    }
    
    nav.md\:hidden span {
        font-size: 0.65rem;
    }
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Fix for modal positioning conflict */
/* Overrides utilities.css to prevent the "jump" effect */
#orderModal .modal-content,
#loginModal .modal-content {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    margin: auto;
    display: flex;
    flex-direction: column;
}

/* Custom scrollbar for modal */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-500), var(--accent-700));
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-600), var(--primary-900));
}
