﻿
/* ============================================
   Page Container
   ============================================ */
.angebote-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-xl) 0;
}

.page-header-content {
    max-width: 600px;
    margin: 0 auto;
}

.page-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    background: var(--color-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    outline: none;
}

.page-subtitle {
    color: var(--color-text-muted);
    font-size: var(--font-size-lg);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Filter Section
   ============================================ */
.filter-section {
    margin-bottom: 12px;
    padding: 12px 16px;
    background: var(--color-bg-card);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

    .filter-group label {
        font-size: 0.65rem;
        font-weight: 500;
        color: var(--color-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .filter-group input,
    .filter-group select {
        height: 44px; /* WCAG touch target minimum */
        padding: 0 12px;
        font-size: 0.875rem;
        font-family: inherit;
        border: 1px solid var(--color-border);
        border-radius: 6px;
        background: var(--color-bg);
        color: var(--color-text);
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
        box-sizing: border-box;
        max-width: 100%;
    }

        .filter-group input::placeholder {
            color: var(--color-text-muted);
        }

        .filter-group input:focus,
        .filter-group select:focus {
            outline: none;
            border-color: var(--color-focus);
            box-shadow: 0 0 0 3px rgba(40, 180, 250, 0.2);
        }

        .filter-group input:focus-visible,
        .filter-group select:focus-visible {
            outline: 2px solid var(--color-focus);
            outline-offset: 2px;
        }

        /* Enhanced dropdown styling for better visibility */
        .filter-group select {
            cursor: pointer;
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            padding-right: 36px;
        }

        .filter-group select option {
            background-color: #2a2a2a;
            color: #ffffff;
            padding: 8px 12px;
            font-size: 0.875rem;
        }

        /* Browser-specific dropdown fixes */
        .filter-group select option:checked {
            background-color: var(--color-primary);
            color: #ffffff;
        }

        .filter-group select option:hover {
            background-color: rgba(56, 189, 255, 0.2);
        }

.filter-search {
    flex: 1;
    min-width: 140px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

    .filter-search .filter-group {
        flex: 1;
    }

.filter-category {
    min-width: 130px;
}

.filter-date {
    min-width: 110px;
}

    .filter-date input {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

.filter-view {
    min-width: auto;
}

/* ============================================
   View Toggle Buttons
   ============================================ */
.view-toggle {
    display: flex;
    gap: 1px;
    background: var(--color-border);
    border-radius: 6px;
    padding: 1px;
    width: fit-content;
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; /* WCAG touch target */
    height: 44px;
    border: none;
    background: var(--color-bg);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

    .view-btn:first-child {
        border-radius: 5px 0 0 5px;
    }

    .view-btn:last-child {
        border-radius: 0 5px 5px 0;
    }

    .view-btn:hover {
        color: var(--color-text);
    }

    .view-btn.active,
    .view-btn[aria-pressed="true"] {
        background: var(--color-primary);
        color: white;
    }

    .view-btn:focus-visible {
        outline: 2px solid var(--color-focus);
        outline-offset: 2px;
        z-index: 1;
    }

    .view-btn svg {
        width: 18px;
        height: 18px;
    }

/* ============================================
   Mobile Filter Toggle
   ============================================ */
.filter-toggle-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

    .filter-toggle-mobile:hover {
        border-color: var(--color-primary);
        color: var(--color-primary);
    }

    .filter-toggle-mobile.expanded,
    .filter-toggle-mobile[aria-expanded="true"] {
        background: var(--color-primary);
        border-color: var(--color-primary);
        color: white;
    }

    .filter-toggle-mobile:focus-visible {
        outline: 2px solid var(--color-focus);
        outline-offset: 2px;
    }

    .filter-toggle-mobile svg {
        width: 18px;
        height: 18px;
    }

/* ============================================
   Collapsible Filters (Mobile)
   ============================================ */
.filter-collapsible {
    display: none;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--color-border);
}

    .filter-collapsible.expanded,
    .filter-collapsible[aria-hidden="false"] {
        display: flex;
    }

/* ============================================
   Filter Results Count
   ============================================ */
.filter-results-count {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-clear-filters {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-family: inherit;
    color: var(--color-primary);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 32px;
}

    .btn-clear-filters:hover {
        background: var(--color-primary);
        color: white;
    }

    .btn-clear-filters:focus-visible {
        outline: 2px solid var(--color-focus);
        outline-offset: 2px;
    }

/* ============================================
   Products Container - Semantic List
   ============================================ */
.products-section {
    margin-top: 12px;
}

/* Remove default list styling */
ul.products-container {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-card-wrapper {
    display: contents;
}

/* ============================================
   Grid View
   ============================================ */
.products-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 16px;
}

.grid-view .product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

    .grid-view .product-card article {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

.grid-view .product-image {
    aspect-ratio: 4/3;
}

.grid-view .product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.grid-view .product-description {
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   List View
   ============================================ */
.products-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.list-view .product-card {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    min-height: 220px;
    overflow: hidden;
}

    .list-view .product-card article {
        display: contents;
    }

.list-view .product-image {
    aspect-ratio: 4/3;
    border-radius: 8px 0 0 8px;
    height: 100%;
    min-height: 220px;
}

    .list-view .product-image img {
        height: 100%;
        object-fit: cover;
    }

.list-view .product-content {
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    justify-content: space-between;
}

.list-view .product-category {
    font-size: 0.75rem;
    margin-bottom: 6px;
}

.list-view .product-name {
    font-size: 1.25rem;
    margin-bottom: 12px;
    line-height: 1.3;
}

.list-view .product-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin-bottom: 16px;
    flex: 1;
}

.list-view .product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
    margin-top: auto;
}

.list-view .product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}

.list-view .btn-details {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
}

/* ============================================
   Product Card - Base Styles (as Link)
   ============================================ */
a.product-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--color-bg-card);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    border: 1px solid var(--color-border);
}

    a.product-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
        border-color: var(--color-primary);
    }

    a.product-card:focus-visible {
        outline: 2px solid var(--color-focus);
        outline-offset: 2px;
        border-color: var(--color-primary);
    }

/* Non-clickable cards (coming soon) */
article.product-card {
    background: var(--color-bg-card);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

    article.product-card.coming-soon {
        opacity: 0.7;
        cursor: default;
    }

/* Unavailable state */
a.product-card.unavailable {
    opacity: 0.6;
}

    a.product-card.unavailable .product-image::after {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.2);
        pointer-events: none;
    }

/* ============================================
   Product Image
   ============================================ */
.product-image {
    position: relative;
    overflow: hidden;
    background: var(--color-bg);
}

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

a.product-card:hover .product-image img {
    transform: scale(1.03);
}

/* ============================================
   Badges
   ============================================ */
.badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    letter-spacing: 0.3px;
    z-index: 1;
}

    .badge.coming-soon-badge {
        background: linear-gradient(135deg, rgba(62, 160, 230, 0.9), rgba(240, 71, 255, 0.9));
        color: #fff;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 1px;
        padding: 6px 14px;
        border-radius: 6px;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    }

    .badge.unavailable-badge {
        background: var(--color-error);
        color: white;
        font-size: 0.65rem;
        max-width: calc(100% - 24px);
        text-align: center;
    }

/* ============================================
   Product Content
   ============================================ */
.product-content {
    padding: 12px;
}

.product-category {
    display: inline-block;
    color: var(--color-primary);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: var(--color-text);
    line-height: 1.3;
}

.product-description {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0 0 10px 0;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    gap: 8px;
}

.product-price {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-details {
    padding: 8px 14px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 4px;
    white-space: nowrap;
    transition: background 0.15s ease;
}

a.product-card:hover .btn-details {
    background: var(--color-primary-dark);
}

.btn-details.disabled {
    opacity: 0.6;
    background: var(--color-border);
    cursor: default;
}

/* ============================================
   No Results & Loading States
   ============================================ */
.no-results {
    text-align: center;
    padding: 48px 16px;
    color: var(--color-text-muted);
}

    .no-results svg {
        margin-bottom: 12px;
        opacity: 0.5;
    }

    .no-results p {
        font-size: 1rem;
        font-weight: 500;
        margin: 0 0 4px 0;
        color: var(--color-text);
    }

    .no-results span {
        font-size: 0.85rem;
        display: block;
        margin-bottom: 16px;
    }

    .no-results .btn-clear-filters {
        margin-top: 8px;
    }

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--color-text-muted);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-container p {
    margin-top: 12px;
}

/* ============================================
   Visually Hidden (Screen Reader Only)
   ============================================ */
.visually-hidden {
    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;
}

/* ============================================
   Desktop Only Helper
   ============================================ */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}

/* ============================================
   Responsive - Tablet
   ============================================ */
@media (max-width: 1024px) {
    .list-view .product-card {
        grid-template-columns: 280px 1fr;
        min-height: 200px;
    }

    .list-view .product-image {
        min-height: 200px;
    }
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media (max-width: 768px) {
    .angebote-page {
        padding: 0 8px;
    }

    .page-header {
        padding: var(--spacing-md) 0;
        margin-bottom: var(--spacing-lg);
    }

    .page-title {
        font-size: var(--font-size-2xl);
    }

    .page-subtitle {
        font-size: var(--font-size-base);
    }

    .filter-section {
        padding: 10px;
    }

    .filter-row {
        gap: 8px;
    }

        /* Hide desktop filters on mobile */
        .filter-row > .filter-group.filter-category,
        .filter-row > .filter-group.filter-date,
        .filter-row > .filter-group.filter-view {
            display: none !important;
        }

    .filter-search {
        width: 100%;
    }

        .filter-search .filter-group label {
            display: none;
        }

    .filter-toggle-mobile {
        display: flex;
    }

    .filter-collapsible .filter-group {
        width: 100%;
        max-width: 100%;
    }

        .filter-collapsible .filter-group input,
        .filter-collapsible .filter-group select {
            height: 44px;
            max-width: 100%;
            box-sizing: border-box;
        }

    .filter-collapsible .filter-view {
        align-self: flex-start;
    }

    /* Grid adjustments */
    .products-container.grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .products-container.list-view {
        gap: 12px;
    }

    /* List view stacks on mobile */
    .list-view .product-card {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .list-view .product-image {
        aspect-ratio: 16/9;
        min-height: 180px;
        border-radius: 8px 8px 0 0;
    }

    .list-view .product-content {
        padding: 16px;
    }

    .list-view .product-name {
        font-size: 1.1rem;
    }

    .list-view .product-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }

    .list-view .product-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .list-view .product-price {
        text-align: center;
    }

    .list-view .btn-details {
        width: 100%;
        text-align: center;
        padding: 12px;
    }

    /* Grid card adjustments */
    .product-content {
        padding: 10px;
    }

    .product-name {
        font-size: 0.85rem;
    }

    .product-description {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
    }

    .grid-view .product-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .grid-view .product-price {
        text-align: center;
        font-size: 0.8rem;
    }

    .grid-view .btn-details {
        width: 100%;
        text-align: center;
        padding: 10px;
    }
}

/* ============================================
   Small Mobile (< 380px)
   ============================================ */
@media (max-width: 380px) {
    .angebote-page {
        padding: 0 6px;
    }

    .products-container.grid-view {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .grid-view .product-image {
        aspect-ratio: 16/9;
    }

    .filter-group input,
    .filter-group select {
        font-size: 0.8rem;
        padding: 0 8px;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    a.product-card,
    article.product-card,
    .product-image img,
    .btn-details,
    .btn-clear-filters,
    .view-btn,
    .filter-toggle-mobile,
    .filter-group input,
    .filter-group select {
        transition: none !important;
    }

        a.product-card:hover {
            transform: none;
        }

            a.product-card:hover .product-image img {
                transform: none;
            }

    .loading-spinner {
        animation: none;
        border-color: var(--color-primary);
        border-top-color: transparent;
        border-right-color: transparent;
    }
}

/* ============================================
   High Contrast Mode Support
   ============================================ */
@media (prefers-contrast: high) {
    a.product-card,
    article.product-card {
        border-width: 2px;
    }

        a.product-card:focus-visible {
            outline-width: 3px;
        }

    .badge {
        border: 1px solid currentColor;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .filter-section,
    .view-toggle,
    .btn-details,
    .filter-toggle-mobile,
    .btn-clear-filters {
        display: none !important;
    }

    .angebote-page {
        max-width: 100%;
        padding: 0;
    }

    .products-container.grid-view,
    .products-container.list-view {
        display: block;
    }

    a.product-card,
    article.product-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #333;
        margin-bottom: 16px;
    }

    .product-image img {
        max-height: 200px;
        object-fit: contain;
    }

    .badge {
        border: 1px solid currentColor;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    a.product-card::after {
        content: " (" attr(href) ")";
        font-size: 0.7rem;
        color: #666;
        display: block;
        padding: 8px 12px;
        border-top: 1px dashed #ccc;
    }
}
