/* Angel Marketplace - Custom CSS */

/* Global Styles */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
}

/* Font Loading Optimization */
.font-brand {
    font-family: 'Coves', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-display: swap;
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Image Fallback Styles */
.image-placeholder {
    background-color: var(--gray-200);
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='200' height='200' fill='%23f5f5f5'/%3E%3Ctext x='50%25' y='50%25' dominant-baseline='central' text-anchor='middle' fill='%23999999' font-family='sans-serif' font-size='14'%3ENo Image%3C/text%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Cart Animation */
.cart-bounce {
    animation: bounce 0.5s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    80% {
        transform: translateY(-5px);
    }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    max-width: 400px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background-color: var(--success-color);
    color: white;
}

.notification.error {
    background-color: var(--error-color);
    color: white;
}

.notification.warning {
    background-color: var(--warning-color);
    color: white;
}

.notification.info {
    background-color: var(--primary-color);
    color: white;
}

/* Product Card Enhancements */
.product-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.product-image {
    transition: transform 0.3s ease-in-out;
}

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

/* Button Enhancements */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--gray-100);
    color: var(--gray-800);
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s ease-in-out;
    border: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: var(--gray-200);
}

/* Form Enhancements */
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input.error {
    border-color: var(--error-color);
}

.form-error {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Header Enhancements */
.header-sticky {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Mobile Menu Improvements */
.mobile-menu {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
}

.mobile-menu.active {
    transform: translateX(0);
}

/* Search Enhancements */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
}

.search-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.search-suggestion:hover {
    background-color: var(--gray-50);
}

/* Mini Cart Enhancements */
.mini-cart {
    max-height: 400px;
    overflow-y: auto;
}

.mini-cart-item {
    transition: background-color 0.2s ease-in-out;
}

.mini-cart-item:hover {
    background-color: var(--gray-50);
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a,
.pagination span {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--gray-700);
    transition: all 0.2s ease-in-out;
}

.pagination a:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .current {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Responsive Design Helpers */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-text-center {
        text-align: center !important;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-break-before {
        page-break-before: always;
    }
    
    .print-break-after {
        page-break-after: always;
    }
}

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

/* Focus styles for better accessibility */
.focus-ring:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --gray-600: #000000;
        --gray-700: #000000;
        --gray-800: #000000;
        --gray-900: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (if needed later) */
@media (prefers-color-scheme: dark) {
    .dark-mode-support {
        background-color: #1a202c;
        color: #f7fafc;
    }
}

/* ============================================
   MOBILE FORM OPTIMIZATIONS
   ============================================ */

/* Prevent iOS zoom on input focus - use 16px minimum */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    input[type="search"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Better touch targets for mobile */
    input,
    textarea,
    select,
    button {
        min-height: 48px;
    }
    
    /* Improve select dropdown appearance on mobile */
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 1.25rem;
        padding-right: 2.5rem;
    }
    
    /* Form labels - better spacing on mobile */
    label {
        margin-bottom: 0.5rem;
        display: block;
    }
    
    /* Form groups spacing */
    .form-group,
    .chat-form-group {
        margin-bottom: 1rem;
    }
}

/* ============================================
   CHECKOUT PAGE MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 640px) {
    /* Checkout section padding */
    .checkout-step {
        padding: 1.25rem !important;
        border-radius: 1rem !important;
    }
    
    /* Step numbers smaller on mobile */
    .step-number {
        width: 1.75rem !important;
        height: 1.75rem !important;
        font-size: 0.75rem !important;
    }
    
    /* Checkout step titles */
    .checkout-step h2 {
        font-size: 1.1rem !important;
    }
    
    /* Phone number field layout */
    .checkout-step .flex.gap-3 {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .checkout-step .flex.gap-3 select {
        width: 100% !important;
    }
    
    /* Country code selector - full width on mobile */
    #countryCode {
        width: 100% !important;
    }
    
    /* Shipping method options */
    .shipping-method-option .p-4 {
        padding: 0.875rem !important;
    }
    
    .shipping-method-option .w-10 {
        width: 2.25rem !important;
        height: 2.25rem !important;
    }
    
    .shipping-method-option h3 {
        font-size: 0.9rem !important;
    }
    
    .shipping-method-option p {
        font-size: 0.75rem !important;
    }
    
    /* Payment method options */
    .payment-form .p-6 {
        padding: 1rem !important;
    }
    
    /* Order summary on mobile */
    .lg\\:col-span-1 .sticky {
        position: relative !important;
        top: auto !important;
    }
    
    /* Cart items in order summary */
    .max-h-96 {
        max-height: 200px !important;
    }
    
    /* Total display */
    #total-display {
        font-size: 1.75rem !important;
    }
    
    /* Submit button */
    #submit-btn,
    .chat-form-submit,
    #contact-submit-btn {
        padding: 1rem !important;
        font-size: 1rem !important;
    }
    
    /* Grid adjustments for address fields */
    .grid.grid-cols-1.md\\:grid-cols-3 {
        gap: 0.75rem !important;
    }
}

/* ============================================
   CONTACT PAGE MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 640px) {
    /* Contact form container */
    .bg-white.rounded-3xl.shadow-xl {
        padding: 1.25rem !important;
        border-radius: 1rem !important;
    }
    
    /* Contact info cards */
    .flex.items-start.p-6 {
        padding: 1rem !important;
    }
    
    /* Contact info icon */
    .w-12.h-12 {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
    
    /* Hero section buttons */
    .flex.flex-wrap.justify-center.gap-4 {
        flex-direction: column;
        width: 100%;
        padding: 0 1rem;
    }
    
    .flex.flex-wrap.justify-center.gap-4 a {
        width: 100%;
        justify-content: center;
    }
    
    /* FAQ grid */
    .grid.md\\:grid-cols-2.gap-8 {
        gap: 1rem !important;
    }
    
    .bg-gray-50.p-8.rounded-2xl {
        padding: 1.25rem !important;
    }
    
    .bg-gray-50.p-8.rounded-2xl h3 {
        font-size: 1rem !important;
    }
}

/* ============================================
   GENERAL MOBILE TOUCH IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Better tap highlighting */
    button,
    a,
    input[type="submit"],
    input[type="button"],
    .cursor-pointer {
        -webkit-tap-highlight-color: rgba(247, 37, 133, 0.1);
    }
    
    /* Prevent text selection on buttons */
    button,
    .btn-primary,
    .btn-secondary {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Smooth scrolling for better UX */
    html {
        scroll-behavior: smooth;
    }
    
    /* Fix for iOS input shadows */
    input,
    textarea {
        -webkit-appearance: none;
        appearance: none;
    }
    
    /* Better focus states for mobile */
    input:focus,
    textarea:focus,
    select:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(247, 37, 133, 0.2);
    }
}

/* ============================================
   SMALL MOBILE SCREENS (< 375px)
   ============================================ */

@media (max-width: 375px) {
    /* Even smaller padding for very small screens */
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    .checkout-step,
    .bg-white.rounded-3xl {
        padding: 1rem !important;
    }
    
    /* Smaller headings */
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    /* Compact form fields */
    input,
    textarea,
    select {
        padding: 0.625rem 0.75rem !important;
    }
}