/**
 * Travel Attributes Component Library
 * Reusable CSS components for displaying and editing travel preferences
 * Version: 2.0
 */

/* ========================================
   DESIGN TOKENS
   ======================================== */

:root {
    /* Primary Colors */
    --attr-primary-blue: #24B8F4;
    --attr-primary-yellow: #FFE02B;
    --attr-white: #FFFFFF;

    /* Neutral Grays */
    --attr-gray-50: #f9fafb;
    --attr-gray-100: #f3f4f6;
    --attr-gray-200: #e5e7eb;
    --attr-gray-300: #d1d5db;
    --attr-gray-400: #9ca3af;
    --attr-gray-600: #4b5563;
    --attr-gray-900: #111827;

    /* Semantic Colors */
    --attr-success: #10b981;
    --attr-error: #ef4444;

    /* Spacing (4px base unit) */
    --attr-space-xs: 4px;
    --attr-space-sm: 8px;
    --attr-space-md: 16px;
    --attr-space-lg: 24px;
    --attr-space-xl: 32px;
    --attr-space-2xl: 40px;

    /* Border Radius */
    --attr-radius-sm: 6px;
    --attr-radius-md: 8px;
    --attr-radius-lg: 12px;
    --attr-radius-full: 9999px;

    /* Shadows */
    --attr-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --attr-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --attr-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12);

    /* Transitions */
    --attr-transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --attr-transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --attr-transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

.attr-section-heading {
    font-size: 22px;
    font-weight: 600;
    color: var(--attr-gray-900);
    margin: 0 0 var(--attr-space-lg) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.attr-category-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--attr-gray-600);
    margin-bottom: var(--attr-space-xs);
}

.attr-value-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--attr-gray-900);
}

.attr-helper-text {
    font-size: 13px;
    font-weight: 400;
    color: var(--attr-gray-600);
    margin-top: var(--attr-space-sm);
}

/* ========================================
   DISPLAY COMPONENTS - ATTRIBUTE CARDS
   ======================================== */

.attributes-container {
    margin-bottom: var(--attr-space-2xl);
    margin-left: 15px;
    margin-right: 15px;
    padding: var(--attr-space-2xl) var(--attr-space-xl);
    background: #ffffff;
    border-radius: var(--attr-radius-lg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.attributes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--attr-space-md);
    margin-top: var(--attr-space-lg);
}

.attribute-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--attr-space-md);
    background: var(--attr-white);
    border: 2px solid var(--attr-gray-200);
    border-radius: var(--attr-radius-lg);
    box-shadow: var(--attr-shadow-md);
    transition: transform var(--attr-transition-base),
                box-shadow var(--attr-transition-base),
                border-color var(--attr-transition-base);
    text-align: center;
    min-height: 140px;
    cursor: default;
}

/* Removed hover effect since attribute cards are not clickable */
/* .attribute-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--attr-shadow-lg);
    border-color: var(--attr-primary-blue);
} */

.attribute-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--attr-space-sm);
    background: linear-gradient(135deg, rgba(36, 184, 244, 0.1) 0%, rgba(255, 224, 43, 0.1) 100%);
    border-radius: 50%;
    flex-shrink: 0;
}

.attribute-icon i {
    font-size: 28px;
    color: var(--attr-primary-blue);
}

.attribute-icon img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.attribute-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--attr-space-xs);
}

/* Empty state for not specified */
.attribute-card.not-specified {
    border-style: dashed;
    border-color: var(--attr-gray-300);
    background: var(--attr-gray-50);
    opacity: 0.6;
}

/* No longer needed since base hover effect is removed */
/* .attribute-card.not-specified:hover {
    transform: none;
    box-shadow: var(--attr-shadow-md);
} */

.attribute-card.not-specified .attribute-icon {
    background: var(--attr-gray-200);
}

.attribute-card.not-specified .attribute-icon i {
    color: var(--attr-gray-400);
}

/* ========================================
   EDIT COMPONENTS - VISUAL RADIO BUTTONS
   ======================================== */

.attr-field-wrapper {
    margin-bottom: var(--attr-space-2xl);
}

.attr-field-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--attr-gray-900);
    margin-bottom: var(--attr-space-md);
    display: block;
}

.attr-field-label .required {
    color: var(--attr-error);
    margin-left: var(--attr-space-xs);
}

.attr-radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--attr-space-md);
    margin-top: var(--attr-space-md);
}

.attr-radio-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--attr-space-md);
    background: var(--attr-white);
    border: 2px solid var(--attr-gray-200);
    border-radius: var(--attr-radius-lg);
    cursor: pointer;
    transition: all var(--attr-transition-base);
    min-height: 110px;
}

.attr-radio-option:hover {
    transform: translateY(-2px);
    box-shadow: var(--attr-shadow-md);
    border-color: var(--attr-gray-400);
}

.attr-radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.attr-radio-option.selected {
    border-color: var(--attr-primary-blue);
    background: rgba(36, 184, 244, 0.05);
    box-shadow: 0 0 0 3px rgba(36, 184, 244, 0.1);
}

.attr-radio-option.selected:hover {
    transform: translateY(-2px);
}

/* Checkmark indicator */
.attr-radio-option .checkmark {
    position: absolute;
    top: var(--attr-space-sm);
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: var(--attr-primary-blue);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    box-shadow: var(--attr-shadow-sm);
    z-index: 1;
}

.attr-radio-option.selected .checkmark {
    display: flex;
}

.attr-radio-icon {
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: var(--attr-space-lg);
    margin-bottom: var(--attr-space-sm);
    flex-shrink: 0;
}

.attr-radio-icon i {
    font-size: 32px;
    color: var(--attr-gray-600);
    transition: color var(--attr-transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.attr-radio-option.selected .attr-radio-icon i {
    color: var(--attr-primary-blue);
}

.attr-radio-icon img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    transition: filter var(--attr-transition-base);
}

.attr-radio-option:not(.selected) .attr-radio-icon img {
    filter: grayscale(30%);
    opacity: 0.8;
}

.attr-radio-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--attr-gray-900);
    text-align: center;
    line-height: 1.3;
}

/* ========================================
   MOBILE ALTERNATIVES
   ======================================== */

/* Horizontal scroll chips for mobile display */
.attributes-scroll-container {
    display: none; /* Hidden by default, shown on mobile */
    margin-top: var(--attr-space-lg);
}

.attributes-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--attr-space-sm);
    justify-content: flex-start;
}

.attribute-chip {
    display: flex;
    align-items: center;
    gap: var(--attr-space-sm);
    padding: var(--attr-space-sm) var(--attr-space-md);
    background: var(--attr-gray-100);
    border: 1px solid var(--attr-gray-200);
    border-radius: var(--attr-radius-full);
    white-space: nowrap;
    flex-shrink: 0;
    height: 44px;
    box-shadow: var(--attr-shadow-sm);
}

.attribute-chip-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attribute-chip-icon i {
    font-size: 18px;
    color: var(--attr-primary-blue);
}

.attribute-chip-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.attribute-chip-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--attr-gray-900);
}

/* List style radio for mobile edit */
.attr-radio-list {
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: var(--attr-space-sm);
}

.attr-radio-list-item {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: var(--attr-space-sm) var(--attr-space-md);
    background: var(--attr-white);
    border: 2px solid var(--attr-gray-200);
    border-radius: var(--attr-radius-md);
    cursor: pointer;
    transition: all var(--attr-transition-base);
    min-height: 56px;
    gap: var(--attr-space-sm);
}

.attr-radio-list-item:hover {
    border-color: var(--attr-gray-400);
    background: var(--attr-gray-50);
}

.attr-radio-list-item.selected {
    border-color: var(--attr-primary-blue);
    background: rgba(36, 184, 244, 0.05);
}

.attr-radio-list-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.attr-list-radio-button {
    width: 24px;
    height: 24px;
    border: 2px solid var(--attr-gray-400);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--attr-transition-base);
    position: relative;
}

.attr-radio-list-item.selected .attr-list-radio-button {
    border-color: var(--attr-primary-blue);
    background: var(--attr-primary-blue);
}

/* Checkmark for mobile list */
.attr-list-radio-button::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
    color: white;
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}

.attr-radio-list-item.selected .attr-list-radio-button::after {
    display: block;
}

.attr-list-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attr-list-icon i {
    font-size: 24px;
    color: var(--attr-gray-600);
}

.attr-radio-list-item.selected .attr-list-icon i {
    color: var(--attr-primary-blue);
}

.attr-list-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.attr-list-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--attr-gray-900);
    flex-grow: 1;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Tablet: 640px - 1023px */
@media (min-width: 640px) and (max-width: 1023px) {
    .attributes-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .attr-radio-group {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: < 640px */
@media (max-width: 639px) {
    /* Reduce padding on mobile */
    .attributes-container {
        padding: var(--attr-space-lg) var(--attr-space-md);
    }

    /* Display view: Show horizontal scroll chips instead of grid */
    .attributes-grid {
        display: none;
    }

    .attributes-scroll-container {
        display: block;
    }

    /* Edit view: Show list instead of grid */
    .attr-radio-group {
        display: none;
    }

    .attr-radio-list {
        display: flex;
    }

    /* Ensure list items are horizontal on mobile */
    .attr-radio-list-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: var(--attr-space-md);
    }

    /* Ensure child elements don't force vertical layout */
    .attr-list-radio-button,
    .attr-list-icon,
    .attr-list-label {
        display: block;
        flex-shrink: 0;
    }

    .attr-list-label {
        flex-shrink: 1;
        flex-grow: 1;
    }

    .attribute-card {
        min-height: 110px;
    }

    .attribute-icon {
        width: 50px;
        height: 50px;
    }

    .attribute-icon i {
        font-size: 24px;
    }

    .attr-category-label {
        font-size: 11px;
    }

    .attr-value-label {
        font-size: 13px;
    }
}

/* Very small mobile: < 375px */
@media (max-width: 374px) {
    .attribute-chip {
        padding: var(--attr-space-sm) 12px;
        height: 40px;
    }

    .attribute-chip-icon {
        width: 20px;
        height: 20px;
    }

    .attribute-chip-icon i {
        font-size: 16px;
    }

    .attribute-chip-text {
        font-size: 13px;
    }
}

/* Desktop: >= 1024px */
@media (min-width: 1024px) {
    .attributes-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        max-width: 100%;
    }

    .attr-radio-group {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large desktop: >= 1280px */
@media (min-width: 1280px) {
    .attributes-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus states */
.attribute-card:focus-visible,
.attr-radio-option:focus-visible,
.attr-radio-list-item:focus-visible,
.attribute-chip:focus-visible {
    outline: 2px solid var(--attr-primary-blue);
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .attribute-card:hover,
    .attr-radio-option:hover,
    .attr-radio-list-item:hover {
        transform: none;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

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

.attr-text-center {
    text-align: center;
}

.attr-hidden {
    display: none;
}

/* ========================================
   LOADING & SKELETON STATES
   ======================================== */

@keyframes attr-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.attribute-card.loading,
.attr-radio-option.loading {
    animation: attr-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    pointer-events: none;
}

.attr-skeleton {
    background: linear-gradient(
        90deg,
        var(--attr-gray-200) 25%,
        var(--attr-gray-100) 50%,
        var(--attr-gray-200) 75%
    );
    background-size: 200% 100%;
    animation: attr-skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes attr-skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
