/* ULTRA-PREMIUM Category Selection Component CSS - FIXED HEADER SPACING */
.category-selector-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    
    /* FIXED: Proper spacing below fixed header */
    margin-top: 90px; /* Safe default for desktop */
    position: relative;
    z-index: 1000; /* Ensures it's above other content */
}

.premium-category-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 22px;
    padding: 32px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible; /* FIXED: Changed from hidden to visible */
}

.premium-category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4361ee, #3a0ca3, #7209b7);
    border-radius: 22px 22px 0 0;
    z-index: 1001;
}

.category-card-header {
    text-align: center;
    margin-bottom: 28px;
    position: relative;
    z-index: 1002;
}

.category-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.category-subtitle {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: #666;
    margin: 0;
    opacity: 0.9;
}

.category-card-body {
    margin-bottom: 24px;
    position: relative;
    z-index: 1002;
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.premium-select {
    width: 100%;
    padding: 16px 52px 16px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: #2d3436;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 14px;
    appearance: none;
    cursor: pointer;
    transition: all 0.25s ease;
    line-height: 1.5;
    box-sizing: border-box;
    min-height: 56px;
    position: relative;
    z-index: 1003;
}

.premium-select:focus {
    outline: none;
    border-color: #4361ee;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.premium-select:hover {
    border-color: #adb5bd;
    background: #ffffff;
}

.premium-select option {
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 400;
    color: #2d3436;
    background: white;
    position: relative;
    z-index: 1004;
}

.premium-select option:disabled {
    color: #adb5bd;
    font-style: italic;
}

.select-arrow {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6c757d;
    transition: transform 0.25s ease;
    z-index: 1003;
}

.premium-select:focus + .select-arrow {
    color: #4361ee;
    transform: translateY(-50%) rotate(180deg);
}

.category-card-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 1002;
}

.hint-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: #6c757d;
    margin: 0;
    opacity: 0.8;
    line-height: 1.5;
}

/* FIXED: Responsive Design with Safe Header Spacing */
@media (max-width: 1024px) {
    .category-selector-container {
        margin-top: 85px; /* Adjusted for tablet */
    }
}

@media (max-width: 768px) {
    .category-selector-container {
        padding: 0 20px;
        max-width: 100%;
        margin-top: 80px; /* Adjusted for mobile */
    }
    
    .premium-category-card {
        padding: 28px 24px;
        border-radius: 20px;
    }
    
    .category-title {
        font-size: 1.5rem;
    }
    
    .premium-select {
        padding: 14px 48px 14px 18px;
        font-size: 0.95rem;
        min-height: 52px;
    }
    
    .select-arrow {
        right: 18px;
    }
}

@media (max-width: 480px) {
    .category-selector-container {
        padding: 0 16px;
        margin-top: 75px; /* Adjusted for small mobile */
    }
    
    .premium-category-card {
        padding: 24px 20px;
        border-radius: 18px;
    }
    
    .category-title {
        font-size: 1.35rem;
    }
    
    .category-subtitle {
        font-size: 0.875rem;
    }
    
    .premium-select {
        padding: 12px 44px 12px 16px;
        font-size: 0.925rem;
        min-height: 48px;
    }
    
    .select-arrow {
        right: 16px;
    }
    
    .select-arrow svg {
        width: 18px;
        height: 18px;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .category-selector-container {
        margin-top: 70px; /* Minimum safe spacing */
    }
}

/* FIXED: Automatic header height detection */
@media (min-height: 800px) {
    .category-selector-container {
        margin-top: 100px; /* More spacing for taller screens */
    }
}

/* Animation for card entrance */
@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.premium-category-card {
    animation: cardEntrance 0.4s ease-out;
}

/* Hover effect for the entire card */
.premium-category-card:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

/* Focus-visible polyfill for better accessibility */
.premium-select:focus-visible {
    outline: 2px solid #4361ee;
    outline-offset: 2px;
}

/* FIXED: Prevent any cropping - ensure everything is visible */
.category-selector-container * {
    overflow: visible;
}

/* FIXED: Ensure dropdown appears above everything */
.premium-select:focus {
    z-index: 1005;
}

/* FIXED: High contrast mode support */
@media (prefers-contrast: high) {
    .premium-category-card {
        border: 2px solid #000;
        background: #fff;
    }
    
    .premium-select {
        border: 2px solid #000;
    }
}

/* FIXED: Print media query - ensure visibility when printing */
@media print {
    .category-selector-container {
        margin-top: 0;
        position: static;
        break-inside: avoid;
    }
}