/**
 * Custom Product Form Styles
 * Organized by component and functionality
 * Author: Dylan Crossan
 */

/* ===============================
   CSS CUSTOM PROPERTIES (VARIABLES)
   =============================== */
:root {
    /* Colors */
    --primary-color: #007cba;
    --secondary-color: #E9C2C2;
    --tertiary-color: #6B1028;
    --main-color: #CC3862;
    --text-color: #2F2F2F;
    --secondary-text-color: #2F2F2F99;
    --background-color: #FEFCFD;
    --error-color: #dc3545;
    --border-color: #dee2e6;
    
    /* Typography */
    --main-text: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --title-font: 'Newsreader', serif;
    --main-title-text-size: 40px;
    --main-title-text-size-mobile: 32px;
    --medium-title-text-size: 18px;
    --small-title-text-size: 16px;
    --small-description-text-size: 14px;
    --text-size-tiny: 12px;
    
    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Spacing */
    --spacing-xs: 5px;
    --spacing-xs-small: 7px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-pill: 100px;
    
    /* Shadows */
    --shadow-sm: 0 1px 5px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ===============================
   BASE LAYOUT & CONTAINER
   =============================== */
.custom-product-form {
    max-width: 600px;
    margin: 0 auto;
    font-family: var(--main-text);
}

.product-form-container {
    display: flex;
    /* gap: var(--spacing-xl); */
    align-items: flex-start;
    min-height: 600px;
}

/* ===============================
   TYPOGRAPHY COMPONENTS test
   =============================== */
.product-title {
    font-weight: var(--font-weight-bold);
    font-size: var(--main-title-text-size);
    color: var(--tertiary-color);
    font-family: var(--title-font);
    margin: 0;
}

.product-price {
    font-weight: var(--font-weight-bold);
    font-size: var(--main-title-text-size);
    color: var(--tertiary-color);
    font-family: var(--title-font);
}

.product-description {
    font-weight: var(--font-weight-normal);
    color: var(--text-color);
    font-size: var(--small-title-text-size);
    margin-bottom: var(--spacing-lg);
}

.section-title {
    font-weight: var(--font-weight-normal);
    font-size: var(--small-title-text-size);
    color: var(--text-color);
    margin-bottom: 14px;
}

.label-text {
    font-weight: var(--font-weight-normal);
    font-size: var(--small-title-text-size);
    color: var(--text-color);
}

.selected-item {
    font-weight: var(--font-weight-semibold);
    font-size: var(--small-title-text-size);
    color: var(--text-color);
}
.description-content{
    margin-top: 14px;
    color: var(--secondary-text-color);
    font-size: var(--small-description-text-size);
}

/* ===============================
   HEADER COMPONENTS
   =============================== */
.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-product-header {
    display: none;
}

.desktop-product-header {
    display: block;
}

/* Breadcrumbs */

.product-breadcrumbs nav,
.product-breadcrumbs nav a,
.product-breadcrumbs nav span {
    font-size: var(--small-title-text-size) !important;
    font-weight: var(--font-weight-normal) !important;
    color: var(--text-color) !important;
}

/* Make the last breadcrumb item (current page) bold */
.product-breadcrumbs nav {
    font-weight: var(--font-weight-bold) !important;
}

/* Reset links to normal weight */
.product-breadcrumbs nav a {
    font-weight: var(--font-weight-normal) !important;
}
.breadcrumb-separator {
    margin-right: 10px;
    margin-left: 10px;
}

/* ===============================
   GALLERY COMPONENTS
   =============================== */
.product-gallery-wrapper {
    flex: 1;
    max-width: 100%;
    top: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 520px;
    margin: 0 auto;
    gap: var(--text-size-tiny);
        position: sticky;
            top: 150px;
            /* 20px from top */
            height: fit-content;
}

/* Main Image */
.main-image-container {
    width: 400px;
    height: 500px;
    background: #f8f8f8;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-md);
}

.main-product-image {
    width: 400px;
    height: 500px !important;
    /* Fill container completely */
    object-fit: cover;
    /* Better than 'fill' - maintains aspect ratio */
    display: block;
    /* Removes inline spacing */
    border-radius: var(--radius-lg);
    transition: transform 0.3s ease;
}

.main-product-image:hover {
    transform: scale(1.01);
}

/* Thumbnail Gallery */
.thumbnail-gallery {
    display: flex;
    justify-content: flex-start;
    gap: var(--spacing-xs);
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: var(--spacing-xs) 0;
    width: 400px;
    /* Instead of fixed 400px */
    min-height: 60px;
    margin-top: 10px;
    /* Prevent height collapse */
}

.gallery-thumbnail {
    width: 80px !important;
    height: 80px !important;
    border-radius: 10px !important;
    object-fit: cover;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
    display: block;
    /* Prevents inline spacing issues */
    background-color: #f8f8f8;
    /* Placeholder while loading */
}

.gallery-thumbnail:hover:not(.active) {
    transform: scale(1.05);
}

/* Add explicit styling for active thumbnails */
.gallery-thumbnail.active {
    transform: scale(1);
    /* Keep normal size */
    /* Add border via box-shadow */
}

/* .gallery-thumbnail.active {
    border-color: var(--primary-color);
} */

/* Scrollbar Styling */
/* .thumbnail-gallery::-webkit-scrollbar {
    height: var(--spacing-sm);
} */

.thumbnail-gallery::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--spacing-sm);
}

.thumbnail-gallery::-webkit-scrollbar-track {
    background: transparent;
}

/* ===============================
   FORM ELEMENTS
   =============================== */
/* .custom-product-form {
    flex: 1;
    padding: var(--spacing-lg);
    max-width: 50%;
} */

/* Taxonomy Pills */
.taxonomy-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs-small);
}

.pill-option {
    position: relative;
    cursor: pointer;
    /* margin-bottom: var(--spacing-xs); */
}

.pill-option input {
    display: none;
}

.pill-label {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--tertiary-color);
    border-radius: var(--spacing-lg);
    font-size: var(--small-title-text-size);
    font-weight: var(--font-weight-normal);
    color: var(--tertiary-color);
    transition: all 0.3s ease;
    position: relative;
}

.pill-option input:checked + .pill-label {
    background: var(--secondary-color);
    color: var(--tertiary-color);
    border-color: white;
}

.pill-option:hover .pill-label {
    border-color: var(--tertiary-color);
    background: var(--secondary-color);
}

/* Price Badge */
.pill-price {
    position: absolute;
    top: -15px;
    right: -15px;
    background: var(--secondary-color);
    color: var(--tertiary-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--spacing-sm);
    font-weight: var(--font-weight-normal);
    line-height: 1;
    z-index: 20;
}

.pill-option .pill-price {
    display: none;
}

.pill-option .pill-price:not(:empty) {
    display: flex;
}

.pill-option[data-has-price="true"] .pill-price {
    display: flex;
}

.pill-option input:checked + .pill-label .pill-price {
    background: var(--secondary-color);
    color: var(--tertiary-color);
}

/* Disabled States */
.pill-option.flavour-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.pill-option.flavour-disabled .pill-label {
    background: #f5f5f5 !important;
    color: #999 !important;
    border-color: var(--border-color) !important;
    pointer-events: none;
}

.pill-option.flavour-disabled:hover {
    opacity: 0.4 !important;
}

.pill-option.flavour-disabled .pill-price {
    color: #999 !important;
}

/* Tooltips */
.pill-option[title] {
    position: relative;
}
.flavour-disabled[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease-in-out 1s forwards;
}

.flavour-disabled[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease-in-out 1s forwards;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
/* ===============================
   FORM INPUTS & QUESTIONS
   =============================== */
.question-group {
    margin-bottom: var(--spacing-md);
}

.question-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    color: #333;
    font-size: var(--text-size-tiny);
}

.question-input {
    width: 100%;
    padding: var(--spacing-sm) var(--text-size-tiny);
    border: 1px solid var(--tertiary-color) !important;
    border-radius: 25px !important;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.question-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* ===============================
   DATE PICKER COMPONENT
   =============================== */
.date-section {
    border-radius: var(--radius-md);
    font-family: var(--main-text);
}

.pickup-date-container {
    font-family: var(--main-text);
    width: 60%;
    max-width: 100%;
    background: transparent;
    padding: 15px;
    height:300px;
    border-radius: var(--radius-md);
    border: none;
    border: 1px solid var(--tertiary-color);
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
    margin-top: var(--spacing-xs);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    padding: 0 var(--spacing-xs);
}

.calendar-header button {
    background: var(--tertiary-color);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 30px;
}



.calendar-header button:hover {
    background: var(--main-color);
}

.calendar-header .month-year {
    font-weight: var(--font-weight-semibold);
    color: var(--tertiary-color);
    font-size: 14px;
    font-family: var(--main-text);
}

/* Loading overlay styles */
.calendar-loading {
    position: relative;
    pointer-events: none;
}

.calendar-loading-overlay {
    position: absolute;
    top: 125px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background-color: transparent;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.calendar-spinner {
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
    color: var(--primary-color, #007cba);
}

.calendar-spinner svg {
    width: 24px;
    height: 24px;
}

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

.loading-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Calendar transition styles */
.calendar-header,
.calendar {
    transition: opacity 0.15s ease-in-out;
}

/* Error state styles */
.calendar-error {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.calendar-error p {
    margin: 0 0 15px 0;
    font-size: 16px;
}

.retry-calendar-btn {
    background: var(--primary-color, #007cba);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.retry-calendar-btn:hover {
    background: var(--primary-color-dark, #005a8c);
}

/* Prevent layout shift during loading */
.calendar-container {
    min-height: 300px; /* Adjust based on your calendar height */
}

.calendar-day {
    padding: var(--spacing-xs) 2px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-color);
    font-weight: var(--font-weight-normal);
    transition: all 0.3s ease;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.calendar-day.limited-availability {
    background-color: var(--secondary-color);
    border-color: #ffffff;
}

.calendar-day.no-availability {
    background-color: #ffffff;
        text-decoration: line-through;
}

.calendar-day.day-disabled {
    background-color: #e2e3e5;
    color: #6c757d;
}
.past-date {
    text-decoration: line-through;
}

.calendar-day:not(.disabled):hover {
    background-color: var(--tertiary-color);
    color: white;
    cursor: pointer;
}
.calendar-day.selected {
    background-color: var(--tertiary-color);
    color: white;
}

.pickup-output {
    font-size: var(--small-title-text-size);
    color: var(--text-color);
    font-weight: var(--font-weight-normal);
    text-align: left;
}

/* ===============================
   CART & BUTTONS
   =============================== */
.cart-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.quantity-selector input {
    width: 80px;
    padding: var(--spacing-xs);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
}

.add-to-cart-btn {
    border-radius: var(--radius-pill);
    cursor: not-allowed;
    opacity: 0.6;
    width: 100%;
    background-color: var(--main-color);
    border: none;
    padding: var(--spacing-md) var(--spacing-lg);
    transition: all 0.3s ease;
}

.add-to-cart-btn:hover {
    color: white;
}

.add-to-cart-btn:disabled {
    border-radius: var(--radius-pill);
    cursor: not-allowed;
    opacity: 0.6;
    width: 100%;
    background-color: var(--main-color);
}

.add-to-cart-btn:not(:disabled) {
    border-radius: var(--radius-pill);
    cursor: pointer;
    opacity: 1;
    width: 100%;
    background-color: var(--main-color);
}

.add-to-cart-btn-text {
    font-size: 18px;
    color: white;
    font-weight: 400;
}

.add-to-cart-btn-price {
    font-size: 18px;
    color: white;
    font-weight: 400;
}

/* ===============================
   ERROR STATES & MESSAGES
   =============================== */
.taxonomy-section.error {
    border-color: var(--error-color);
    background-color: #fdf2f2;
}

.form-messages {
    margin-top: var(--spacing-md);
}

.success-message,
.error-message {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===============================
   RESPONSIVE DESIGN - TABLET
   =============================== */
   @media (max-width: 1200px) {
        .custom-product-form {
            margin-left: 40px;
        }
}
@media (max-width: 876px) {
    .pickup-date-container{
        width: 100%;
    }
}
@media (max-width: 800px) {
    /* Layout */
    .product-form-container {
        flex-direction: column;
        gap: var(--spacing-lg);
    }

    .product-gallery-wrapper,
    .custom-product-form {
        max-width: 100%;
        flex: none;
    }

        .product-gallery-wrapper {
            position: static;
            max-width: 100% !important;
            width: 100%;
            margin: 0;
            order: 1;
            min-height: 350px;
            /* Prevents height collapse */
        }
        
        .product-gallery-section {
            width: 100%;
            max-width: 100%;
            min-height: 350px;
            /* Match wrapper height */
        }

    .main-image-container {
        width: 100%;
        max-width: 100%;
    }

    /* Gallery */
    .thumbnail-gallery {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        padding: 0 var(--spacing-sm);
        margin-top: var(--spacing-sm);
    }

    .gallery-thumbnail {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }

    /* Form */
    .custom-product-form {
        padding: var(--spacing-xs-small);
        order: 2;
                    margin-left: 0px;
    }

    .add-to-cart-btn {
        width: 100%;
        justify-content: center;
    }

    /* Headers */
    .mobile-product-header {
        display: block;
    }

    .desktop-product-header {
        display: none;
    }

    /* Pills */
    .pill-price {
        width: 28px;
        height: 28px;
        font-size: var(--spacing-sm);
        top: -8px;
        right: -8px;
    }



    /* Date Picker */
    .date-section {
        margin-bottom: 10px;
    }

    .calendar-day {
        padding: 6px 1px;
        font-size: var(--text-size-tiny);
        min-height: 26px;
    }
    .pickup-date-container {
        width: 100%;
    }

    .calendar-header button {
        padding: var(--spacing-xs) var(--spacing-xs);
        font-size: 18px;
        font-weight: bold;
        min-width: 30px;
        min-height: 30px;
    }

    .calendar-header .month-year {
        font-size: var(--text-size-tiny);
    }

    .calendar-day-header {
        padding: var(--spacing-xs) 1px;
        font-size: var(--spacing-sm);
    }

    .pickup-output {
        font-size: 13px;
    }
}

/* ===============================
   RESPONSIVE DESIGN - MOBILE
   =============================== */
@media (max-width: 480px) {
    /* Layout */
    .product-form-container {
        gap: 0px;
    }

    .product-gallery-section {
        padding: var(--spacing-md);
    }

    /* Gallery */
    .gallery-thumbnail {
        width: 60px;
        height: 60px;
    }

    /* Date Picker */
    .calendar {
        gap: 1px;
    }

    .calendar-day {
        min-height: 24px;
        font-size: 11px;
    }
    .pickup-date-container {
        width: 100%;
    }
    .mobile-product-header {
        position: sticky;
        top: 71px;
        z-index: 98;
        background: white;
        width: 100%;
        padding: var(--spacing-sm);
        padding-bottom: 0px;

    }
    .product-title {
        font-size: var(--main-title-text-size-mobile);
    }
    .product-price {
        font-size: var(--main-title-text-size-mobile);
    }

}

/* Cart date notice styling */
.cart-notice {
    display: flex;
    align-items: flex-start;
    background: #ffffff;
    border: 1px solid var(--tertiary-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.4;
}

.cart-notice .notice-icon {
    flex-shrink: 0;
    margin-right: 12px;
    margin-top: 2px;
}

.cart-notice .notice-content {
    flex: 1;
}

.cart-notice .notice-content strong {
    display: block;
    color: #0066cc;
    font-weight: 600;
    margin-bottom: 4px;
}

.cart-notice .notice-content p {
    margin: 0;
    color: #333;
}

.cart-notice .notice-content #cart-pickup-date {
    font-weight: 600;
    color: var(--tertiary-color);
}

/* Alternative warning-style notice */
.cart-notice.warning {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.cart-notice.warning .notice-icon svg {
    stroke: #856404;
}

.cart-notice.warning strong {
    color: #856404;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .cart-notice {
        padding: 12px;
        font-size: 13px;
    }

    .cart-notice .notice-icon {
        margin-right: 8px;
    }
}

.clear-cart-btn {
    background-color: #ffffff !important;
    color: var(--tertiary-color) !important;
    border: 1px solid var(--tertiary-color) !important;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: background-color 0.2s ease;
}

.clear-cart-btn:hover:not(:disabled) {
    background: var(--tertiary-color) !important;
    border: 1px solid var(--tertiary-color) !important;
    color: #ffffff !important;
}

.clear-cart-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Success/error messages */
.success-message,
.error-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px 0;
    font-size: 14px;
    font-weight: 500;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}