/* Custom styles for StoreIQ website */

:root {
    --primary-color: #2159FA;
}

body {
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    position: relative;
}

.bg-primary {
    background-color: var(--primary-color);
}

.text-primary {
    color: var(--primary-color);
}

.hover-primary:hover {
    color: var(--primary-color);
}

/* Header styles */
header {
    position: relative;
    z-index: 1000;
    background: white;
}

#language-selector {
    height: 40px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%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.5rem center;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Hide mobile menu by default */
#mobile-menu-button {
    display: none;
}

/* Mobile styles */
@media (max-width: 768px) {
    .hidden-mobile {
        display: none;
    }

    /* Mobile menu button */
    #mobile-menu-button {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 8px;
        background-color: var(--primary-color);
        border: none;
        border-radius: 8px;
        cursor: pointer;
        position: relative;
        z-index: 1002;
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }

    #mobile-menu-button svg {
        width: 24px;
        height: 24px;
        color: white;
        transition: opacity 0.2s ease;
    }

    #mobile-menu-button .close-icon {
        position: absolute;
    }

    /* Mobile menu overlay */
    .mobile-menu-overlay {
        visibility: hidden;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        background-color: rgba(0, 0, 0, 0.6);
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .mobile-menu-overlay.active {
        visibility: visible;
        opacity: 1;
    }

    /* Mobile menu drawer */
    #mobile-menu {
        visibility: hidden;
        position: fixed;
        top: 0;
        right: 0;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        background: white;
        z-index: 1001;
        opacity: 0;
        transform: translateX(100%);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #mobile-menu.active {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
    }

    .mobile-menu-content {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .mobile-menu-header {
        padding: 24px 24px 16px;
        border-bottom: 1px solid #e5e7eb;
        flex-shrink: 0;
    }

    .mobile-menu-nav {
        flex: 1;
        padding: 8px 0;
    }

    .mobile-menu-link {
        display: flex;
        align-items: center;
        padding: 16px 24px;
        color: #1f2937;
        text-decoration: none;
        font-weight: 500;
        font-size: 16px;
        line-height: 1.5;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
        transition: all 0.2s ease;
        min-height: 44px;
        touch-action: manipulation;
        cursor: pointer;
    }

    .mobile-menu-link:hover,
    .mobile-menu-link:focus {
        background-color: #f3f4f6;
        color: var(--primary-color);
        outline: none;
    }

    .mobile-menu-link:focus-visible {
        outline: 2px solid var(--primary-color);
        outline-offset: -2px;
    }

    .mobile-language-btn {
        border-top: 1px solid #e5e7eb;
        margin-top: 8px;
        padding-top: 24px;
    }

    .mobile-menu-footer {
        padding: 16px 24px 24px;
        border-top: 1px solid #e5e7eb;
        flex-shrink: 0;
    }

    .mobile-feedback-btn {
        width: 100%;
        padding: 12px 16px;
        background-color: #f3f4f6;
        border: 2px solid #d1d5db;
        border-radius: 8px;
        color: #374151;
        font-weight: 500;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.2s ease;
        min-height: 44px;
        touch-action: manipulation;
    }

    .mobile-feedback-btn:hover,
    .mobile-feedback-btn:focus {
        background-color: #e5e7eb;
        border-color: var(--primary-color);
        color: var(--primary-color);
        outline: none;
    }

    .mobile-feedback-btn:focus-visible {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    /* Support for reduced motion */
    @media (prefers-reduced-motion: reduce) {

        .mobile-menu-overlay,
        #mobile-menu,
        #mobile-menu-button svg,
        .mobile-menu-link,
        .mobile-feedback-btn {
            transition: none;
        }
    }
}

/* Cookie Consent Banner */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#cookie-banner.show {
    transform: translateY(0);
}

#cookie-banner .cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.cookie-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.cookie-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    min-height: 44px;
    display: flex;
    align-items: center;
    touch-action: manipulation;
}

.cookie-btn-accept {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.cookie-btn-accept:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.cookie-btn-reject {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.cookie-btn-reject:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.cookie-btn-settings {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.cookie-btn-settings:hover {
    background: #eff6ff;
}

/* Cookie Preferences Modal */
#cookie-preferences {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#cookie-preferences.show {
    opacity: 1;
    visibility: visible;
}

.cookie-modal {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#cookie-preferences.show .cookie-modal {
    transform: scale(1);
}

.cookie-modal-header {
    padding: 24px 24px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.cookie-modal-body {
    padding: 0 24px 24px;
}

.cookie-category {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f3f4f6;
}

.cookie-category:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.cookie-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cookie-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.cookie-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.cookie-slider {
    background-color: var(--primary-color);
}

input:checked+.cookie-slider:before {
    transform: translateX(24px);
}

.cookie-slider.disabled {
    background-color: #d1d5db;
    cursor: not-allowed;
}

.cookie-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

/* Mobile responsiveness for cookie banner */
@media (max-width: 768px) {
    #cookie-banner .cookie-content {
        padding: 16px;
    }

    .cookie-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-btn {
        width: 100%;
        justify-content: center;
    }

    .cookie-modal {
        width: 95%;
        max-height: 85vh;
    }

    .cookie-modal-header {
        padding: 20px 20px 0;
    }

    .cookie-modal-body {
        padding: 0 20px 20px;
    }

    .cookie-modal-actions {
        flex-direction: column;
    }
}

/* Feedback Modal */
.feedback-modal.show {
    opacity: 1 !important;
    visibility: visible !important;
}

.feedback-modal.show .bg-white {
    transform: scale(1) !important;
}

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

/* Focus states for better accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #2563eb !important;
    outline-offset: 2px !important;
    border-radius: 4px !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-gray-600 {
        color: #374151 !important;
    }

    .bg-gray-100 {
        background-color: #f9fafb !important;
    }

    .border-gray-300 {
        border-color: #6b7280 !important;
    }
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #2563eb;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    font-weight: 600;
}

.skip-link:focus {
    top: 6px;
}

/* Ensure minimum touch target size */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn,
a[role="button"] {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Improved color contrast for links */
a {
    color: #1d4ed8;
}

a:hover {
    color: #1e40af;
    text-decoration: underline;
}

/* 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;
        scroll-behavior: auto !important;
    }

    #cookie-banner,
    #cookie-preferences,
    .cookie-modal,
    .cookie-slider,
    .cookie-slider:before,
    .feedback-modal,
    .feedback-modal .bg-white {
        transition: none !important;
    }
}