/**
 * Color Scheme Definitions
 * Dynamically applied based on admin selection
 */

/* Default: Rustic Earth & Forest */
:root {
    --primary-gradient-start: #2C5F2D;
    --primary-gradient-end: #5D4E37;
    --primary-color: #2C5F2D;
    --secondary-color: #3D6F3E;
    --button-color: #2C5F2D;
    --background: #F5F1E8;
    --header-bg: linear-gradient(135deg, #2C5F2D 0%, #5D4E37 100%);
}

/* Modern Ranch */
[data-color-scheme="modern-ranch"] {
    --primary-gradient-start: #7C2529;
    --primary-gradient-end: #3A3A3C;
    --primary-color: #7C2529;
    --secondary-color: #5A2E30;
    --button-color: #7C2529;
    --background: #FAF7F2;
    --header-bg: linear-gradient(135deg, #7C2529 0%, #3A3A3C 100%);
}

/* Desert Timber */
[data-color-scheme="desert-timber"] {
    --primary-gradient-start: #C19A6B;
    --primary-gradient-end: #8B7355;
    --primary-color: #C19A6B;
    --secondary-color: #9D8159;
    --button-color: #C19A6B;
    --background: #FEFDF8;
    --header-bg: linear-gradient(135deg, #C19A6B 0%, #8B7355 100%);
}

/* Slate Blue */
[data-color-scheme="slate-blue"] {
    --primary-gradient-start: #4A5568;
    --primary-gradient-end: #2D3748;
    --primary-color: #4A5568;
    --secondary-color: #2D3748;
    --button-color: #4A5568;
    --background: #F7FAFC;
    --header-bg: linear-gradient(135deg, #4A5568 0%, #2D3748 100%);
}

/* Forest Sage */
[data-color-scheme="forest-sage"] {
    --primary-gradient-start: #6B8E6F;
    --primary-gradient-end: #4A6B4E;
    --primary-color: #6B8E6F;
    --secondary-color: #4A6B4E;
    --button-color: #6B8E6F;
    --background: #F5F9F5;
    --header-bg: linear-gradient(135deg, #6B8E6F 0%, #4A6B4E 100%);
}

/* Navy Steel */
[data-color-scheme="navy-steel"] {
    --primary-gradient-start: #2C5282;
    --primary-gradient-end: #1A365D;
    --primary-color: #2C5282;
    --secondary-color: #1A365D;
    --button-color: #2C5282;
    --background: #F0F7FF;
    --header-bg: linear-gradient(135deg, #2C5282 0%, #1A365D 100%);
}

/* Autumn Oak */
[data-color-scheme="autumn-oak"] {
    --primary-gradient-start: #A0522D;
    --primary-gradient-end: #6B4423;
    --primary-color: #A0522D;
    --secondary-color: #6B4423;
    --button-color: #A0522D;
    --background: #FFF8F0;
    --header-bg: linear-gradient(135deg, #A0522D 0%, #6B4423 100%);
}

/* Pewter Charcoal */
[data-color-scheme="pewter-charcoal"] {
    --primary-gradient-start: #6C757D;
    --primary-gradient-end: #495057;
    --primary-color: #6C757D;
    --secondary-color: #495057;
    --button-color: #6C757D;
    --background: #F8F9FA;
    --header-bg: linear-gradient(135deg, #6C757D 0%, #495057 100%);
}

/* Christmas Holiday */
[data-color-scheme="christmas-holiday"] {
    --primary-gradient-start: #C41E3A;
    --primary-gradient-end: #0C5F2D;
    --primary-color: #C41E3A;
    --secondary-color: #0C5F2D;
    --button-color: #C41E3A;
    --background: #FFFEF8;
    --header-bg: linear-gradient(135deg, #C41E3A 0%, #0C5F2D 100%);
}

/* Christmas Lights Animation - Apply to all card types */
[data-color-scheme="christmas-holiday"] .product-card,
[data-color-scheme="christmas-holiday"] .custom-product-card,
[data-color-scheme="christmas-holiday"] [style*="box-shadow"][style*="border-radius"] {
    position: relative;
}

[data-color-scheme="christmas-holiday"] .product-card::before,
[data-color-scheme="christmas-holiday"] .custom-product-card::before,
[data-color-scheme="christmas-holiday"] [style*="box-shadow"][style*="border-radius"]::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    height: 18px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 20px,
        #FFD700 20px,
        #FFD700 22px,
        transparent 22px,
        transparent 42px
    );
    z-index: 10;
    pointer-events: none;
}

[data-color-scheme="christmas-holiday"] .product-card::after,
[data-color-scheme="christmas-holiday"] .custom-product-card::after,
[data-color-scheme="christmas-holiday"] [style*="box-shadow"][style*="border-radius"]::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 14px;
    background-image:
        radial-gradient(circle at 10px, #FF4444 7px, transparent 7px),
        radial-gradient(circle at 30px, #4444FF 7px, transparent 7px),
        radial-gradient(circle at 50px, #44FF44 7px, transparent 7px),
        radial-gradient(circle at 70px, #FFD700 7px, transparent 7px),
        radial-gradient(circle at 90px, #FF44FF 7px, transparent 7px);
    background-size: 100px 14px;
    background-repeat: repeat-x;
    animation: christmasLights 3s linear infinite;
    z-index: 11;
    pointer-events: none;
}

/* Add mistletoe decoration in top-right corner */
[data-color-scheme="christmas-holiday"] .custom-product-card > div:first-child::after,
[data-color-scheme="christmas-holiday"] [style*="box-shadow"][style*="border-radius"] > div:first-child::after {
    content: '🎄';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 2rem;
    z-index: 12;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    animation: mistletoeFloat 3s ease-in-out infinite;
}

@keyframes mistletoeFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-5px) rotate(5deg);
    }
}

@keyframes christmasLights {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 3px currentColor);
    }
    25% {
        filter: brightness(1.3) drop-shadow(0 0 6px #FFD700);
    }
    50% {
        filter: brightness(0.8) drop-shadow(0 0 2px currentColor);
    }
    75% {
        filter: brightness(1.2) drop-shadow(0 0 5px #FF4444);
    }
}

/* Add snow effect for Christmas theme */
[data-color-scheme="christmas-holiday"] body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image:
        radial-gradient(circle, white 1px, transparent 1px),
        radial-gradient(circle, white 1px, transparent 1px),
        radial-gradient(circle, white 2px, transparent 2px);
    background-size: 50px 50px, 100px 100px, 150px 150px;
    background-position: 0 0, 40px 60px, 130px 270px;
    animation: snowfall 20s linear infinite;
    opacity: 0.6;
    z-index: 9999;
}

@keyframes snowfall {
    0% {
        background-position: 0 0, 40px 60px, 130px 270px;
    }
    100% {
        background-position: 0 500px, 40px 560px, 130px 770px;
    }
}

/* Custom button color override */
[data-custom-button-color] {
    --button-color: var(--custom-button-color);
}

/* Manufacturer Override - Solid Header Background (All Manufacturers) */
[data-manufacturer="stormor"] header,
[data-manufacturer="graceland"] header,
[data-manufacturer="instashed"] header {
    background: var(--primary-color) !important;
}

/* Three-column header layout for ALL manufacturers (left: dealer info, center: logo, right: buttons) */
header .header-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2rem;
}

header .header-left {
    justify-self: start;
}

/* Reduce left margin for ALL manufacturers */
header .container {
    padding-left: 8px;
}

header #business-name-header {
    text-align: left;
    line-height: 1.1;
}

header .header-center {
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

header .header-right {
    justify-self: end;
}

/* Smart text color with outline based on background (ALL manufacturers) */
header #business-name-header,
header .phone-text,
header .hours-text,
header .phone-link {
    /* Calculate luminance and use appropriate text color */
    /* Light backgrounds get black text with white outline */
    /* Dark backgrounds get white text with black outline */
    color: inherit; /* Will be set by JavaScript */
    -webkit-text-stroke: inherit; /* Will be set by JavaScript */
    paint-order: stroke fill;
    text-shadow: none !important; /* Remove default text shadow */
}
