/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #222;
    line-height: 1.6;
}

/* Danish Red Theme */
:root {
    --danish-red: #c60c30;
    --danish-red-dark: #a50a25;
    --danish-red-light: #e8394f;
    --success-green: #28a745;
    --warning-orange: #fd7e14;
    --info-blue: #17a2b8;
    --light-gray: #f8f9fa;
    --medium-gray: #6c757d;
    --dark-gray: #343a40;
    --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    --card-hover-shadow: 0 15px 40px rgba(0, 0, 0, 0.18);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(rgba(198, 12, 48, 0.8), rgba(198, 12, 48, 0.8)), url('https://images.unsplash.com/photo-1551969672-9dcb639b61de?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1200&q=80') center/cover no-repeat;
    padding: 80px 0;
    position: relative;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(198, 12, 48, 0.1), rgba(198, 12, 48, 0.3));
    pointer-events: none;
}

/* Navbar */
.navbar {
    border-bottom: 2px solid var(--danish-red);
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95) !important;
}

.navbar-brand {
    font-size: 1.6rem;
    letter-spacing: 1px;
    font-weight: 700;
}

.nav-link.active, .nav-link:focus, .nav-link:hover {
    color: var(--danish-red) !important;
    font-weight: bold;
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

/* Buttons */
.btn-filter {
    background-color: #fff;
    border: 2px solid var(--danish-red);
    border-radius: 30px;
    padding: 8px 20px;
    margin: 5px;
    color: var(--danish-red);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-filter::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-filter:hover::before {
    left: 100%;
}

.btn-filter.active, .btn-filter:hover {
    background-color: var(--danish-red);
    color: #fff;
    border-color: var(--danish-red);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(198, 12, 48, 0.3);
}

.btn-danger {
    background-color: var(--danish-red);
    border: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.btn-danger:hover {
    background-color: var(--danish-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(198, 12, 48, 0.3);
}

.btn-outline-secondary {
    border-color: var(--medium-gray);
    color: var(--medium-gray);
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background-color: var(--medium-gray);
    border-color: var(--medium-gray);
    transform: translateY(-1px);
}

.btn-outline-danger {
    border-color: var(--danish-red);
    color: var(--danish-red);
    transition: all 0.3s ease;
}

.btn-outline-danger:hover {
    background-color: var(--danish-red);
    border-color: var(--danish-red);
    transform: translateY(-1px);
}

/* ==================== */
/* Unified Product Cards */
/* ==================== */

/* Base Card Styles */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(198, 12, 48, 0.02), rgba(198, 12, 48, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-hover-shadow);
}

/* Unified Image Container */
.card-img-container {
    position: relative;
    width: 100%;
    height: 280px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-img-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(198, 12, 48, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* Unified Image Styles */
.card-img-top {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    width: auto;
    height: auto;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.card:hover .card-img-top {
    transform: scale(1.08);
}

/* Card Body Styles */
.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    background: #fff;
    position: relative;
    z-index: 2;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--danish-red);
    margin-bottom: 0.75rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-text {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* Card Footer */
.card-footer {
    background: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
    margin-top: auto;
}

/* Product Card Specific Styles */
.product-card {
    min-height: 480px;
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

/* Search Input */
.search-box {
    position: relative;
    max-width: 500px;
}

.search-box .form-control {
    border-radius: 30px 0 0 30px;
    border: 2px solid var(--danish-red);
    box-shadow: none;
    padding: 12px 20px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-box .form-control:focus {
    border-color: var(--danish-red-light);
    box-shadow: 0 0 0 0.2rem rgba(198, 12, 48, 0.25);
}

.search-box .btn {
    border-radius: 0 30px 30px 0;
    border: 2px solid var(--danish-red);
    border-left: none;
    background-color: var(--danish-red);
    padding: 12px 20px;
    transition: all 0.3s ease;
}

.search-box .btn:hover {
    background-color: var(--danish-red-dark);
    transform: scale(1.05);
}

/* Badges */
.badge {
    font-size: 0.75rem;
    padding: 0.4em 0.8em;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.25rem;
}

.badge.bg-danger {
    background-color: var(--danish-red) !important;
}

.badge.bg-secondary {
    background-color: var(--medium-gray) !important;
}

/* Loading States */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
    animation: spin 1s linear infinite;
}

.spinner-border.text-danger {
    color: var(--danish-red) !important;
}

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

/* Alert Messages */
.alert {
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danish-red);
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--info-blue);
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success-green);
}

.alert .display-1 {
    font-size: 4rem;
    opacity: 0.3;
}

.alert h4 {
    color: inherit;
    font-weight: 700;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Staggered animation for product cards */
.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }
.product-card:nth-child(7) { animation-delay: 0.7s; }
.product-card:nth-child(8) { animation-delay: 0.8s; }
.product-card:nth-child(9) { animation-delay: 0.9s; }
.product-card:nth-child(10) { animation-delay: 1.0s; }
.product-card:nth-child(11) { animation-delay: 1.1s; }
.product-card:nth-child(12) { animation-delay: 1.2s; }

/* Form Styles */
.form-control {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--danish-red);
    box-shadow: 0 0 0 0.2rem rgba(198, 12, 48, 0.25);
    transform: translateY(-1px);
}

.form-label {
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    margin-top: auto;
    background: linear-gradient(135deg, var(--dark-gray), #212529) !important;
}

/* General Utility Classes */
.fw-bold.text-danger {
    color: var(--danish-red) !important;
}

.sticky-top {
    z-index: 1030;
}

.text-muted {
    color: var(--medium-gray) !important;
}

/* Loading Container */
#loadingContainer {
    padding: 3rem 0;
}

#loadingContainer p {
    font-size: 1.1rem;
    color: var(--medium-gray);
    margin-top: 1rem;
}

/* Error and No Results States */
#errorMessage, #noResultsMessage {
    margin: 2rem 0;
}

#noResultsMessage .display-1 {
    color: var(--medium-gray);
    opacity: 0.3;
}

/* ==================== */
/* Product Detail Page  */
/* ==================== */

/* Product Detail Section */
.product-detail-section {
    padding: 60px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.product-detail-container {
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.product-detail-image {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    position: relative;
    overflow: hidden;
}

.product-detail-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(198, 12, 48, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.product-detail-image img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    width: auto;
    height: auto;
    transition: transform 0.4s ease;
    position: relative;
    z-index: 2;
}

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

.product-detail-info {
    padding: 3rem;
}

.product-detail-info h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--danish-red);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.product-detail-info .lead {
    font-size: 1.25rem;
    line-height: 1.8;
    color: #495057;
    margin-bottom: 2rem;
}

/* Breadcrumb Styles */
.breadcrumb {
    background-color: transparent;
    padding: 1rem 0;
    margin-bottom: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
    color: var(--danish-red);
}

.breadcrumb-item.active {
    color: var(--danish-red);
    font-weight: 500;
}

/* Product Action Buttons */
.product-actions {
    margin-top: 2.5rem;
}

.product-actions .btn {
    padding: 0.875rem 2.5rem;
    font-weight: 600;
    border-radius: 12px;
    min-width: 180px;
    font-size: 1.1rem;
}

/* Keywords Section */
.product-keywords {
    margin: 2.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.product-keywords h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
}

.product-keywords .badge {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #495057;
    transition: all 0.2s ease;
}

.product-keywords .badge:hover {
    background-color: var(--danish-red);
    color: #fff;
    transform: translateY(-2px);
}

/* ==================== */
/* Related Products     */
/* ==================== */

.related-products-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 80px 0;
    margin-top: 80px;
    border-top: 1px solid #e9ecef;
}

.related-products-section h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--danish-red);
    margin-bottom: 4rem;
    text-align: center;
    position: relative;
}

.related-products-section h2::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--danish-red);
    border-radius: 2px;
}

/* Related Product Cards - Using same base styles */
.related-product-card {
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    position: relative;
}

.related-product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-hover-shadow);
}

.related-product-card .card-img-container {
    height: 220px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
}

.related-product-card .card-img-top {
    max-width: 85%;
    max-height: 85%;
}

.related-product-card .card-body {
    padding: 1.25rem;
}

.related-product-card .card-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.related-product-card .card-text {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    -webkit-line-clamp: 2;
}

.related-product-card .btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

/* ==================== */
/* Responsive Design    */
/* ==================== */

@media (max-width: 1200px) {
    .product-card {
        min-height: 450px;
    }
    
    .card-img-container {
        height: 250px;
    }
}

@media (max-width: 991px) {
    .card-img-container {
        height: 220px;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .product-card {
        min-height: 420px;
    }
    
    .product-detail-info {
        padding: 2rem;
    }
    
    .product-detail-info h1 {
        font-size: 2rem;
    }
    
    .product-detail-image {
        min-height: 400px;
    }
}

@media (max-width: 767px) {
    .card-img-container {
        height: 200px;
    }
    
    .btn-filter {
        padding: 6px 16px;
        font-size: 0.875rem;
        margin: 3px;
    }
    
    .hero-section {
        padding: 60px 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .product-card {
        min-height: 400px;
    }
    
    .search-box .form-control,
    .search-box .btn {
        padding: 10px 16px;
    }
    
    .product-detail-section {
        padding: 40px 0;
    }
    
    .product-detail-container {
        border-radius: 12px;
    }
    
    .product-detail-image {
        min-height: 300px;
    }
    
    .product-detail-info {
        padding: 1.5rem;
    }
    
    .product-detail-info h1 {
        font-size: 1.75rem;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .product-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .related-products-section {
        padding: 60px 0;
        margin-top: 60px;
    }
    
    .related-products-section h2 {
        font-size: 1.8rem;
        margin-bottom: 3rem;
    }
    
    .related-product-card .card-img-container {
        height: 180px;
    }
}

@media (max-width: 575px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .card-img-container {
        height: 180px;
    }
    
    .card-title {
        font-size: 0.95rem;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    .product-card {
        min-height: 380px;
    }
    
    .btn-filter {
        padding: 5px 12px;
        font-size: 0.75rem;
        margin: 2px;
    }
    
    .search-box .form-control,
    .search-box .btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .alert {
        padding: 1rem;
    }
    
    .product-detail-image {
        min-height: 250px;
    }
    
    .product-detail-info h1 {
        font-size: 1.5rem;
    }
    
    .product-keywords {
        margin: 1.5rem 0;
        padding: 1rem;
    }
    
    .related-products-section {
        padding: 40px 0;
        margin-top: 40px;
    }
    
    .related-products-section h2 {
        font-size: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .related-product-card .card-img-container {
        height: 150px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--dark-gray);
    }
    
    .btn-filter {
        border-width: 3px;
    }
    
    .form-control {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .navbar,
    .hero-section,
    .btn,
    .modal,
    footer {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .card-img-top {
        max-height: 200px;
    }
}