/* Cascading Category Dropdown Styles */
.cascading-dropdown-container {
    max-width: 600px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.ccd-dropdown-wrapper {
    margin-bottom: 20px;
    position: relative;
}

.ccd-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: hsl(220 13% 18%); /* #2c3e50 */
    font-size: 14px;
}

.ccd-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid hsl(220 13% 91%); /* #e0e6ed */
    border-radius: 8px;
    background-color: hsl(0 0% 100%); /* #ffffff */
    font-size: 16px;
    line-height: 1.5;
    color: hsl(220 13% 18%); /* #2c3e50 */
    transition: all 0.3s ease;
    box-sizing: border-box;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.ccd-select:focus {
    outline: none;
    border-color: hsl(212 92% 43%); /* #0073aa */
    box-shadow: 0 0 0 3px hsla(212 92% 43% / 0.1); /* rgba(0, 115, 170, 0.1) */
}

.ccd-select:hover {
    border-color: hsl(220 13% 80%); /* #bdc3c7 */
}

.ccd-select:disabled {
    background-color: hsl(220 13% 96%); /* #f8f9fa */
    color: hsl(220 13% 60%); /* #7f8c8d */
    cursor: not-allowed;
}

.ccd-subcategory-wrapper {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.ccd-subcategory-wrapper.show {
    opacity: 1;
    transform: translateY(0);
}

.ccd-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    color: hsl(220 13% 60%); /* #7f8c8d */
    font-size: 14px;
}

.ccd-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid hsl(220 13% 91%); /* #e0e6ed */
    border-top: 2px solid hsl(212 92% 43%); /* #0073aa */
    border-radius: 50%;
    animation: ccd-spin 1s linear infinite;
}

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

.ccd-error {
    color: hsl(348 83% 47%); /* #e74c3c */
    background-color: hsl(348 83% 96%); /* #fdf2f2 */
    border: 1px solid hsl(348 83% 87%); /* #f5b7b1 */
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cascading-dropdown-container {
        margin: 15px 0;
    }
    
    .ccd-dropdown-wrapper {
        margin-bottom: 15px;
    }
    
    .ccd-select {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .ccd-label {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .cascading-dropdown-container {
        margin: 10px 0;
    }
    
    .ccd-dropdown-wrapper {
        margin-bottom: 12px;
    }
    
    .ccd-select {
        padding: 12px 14px;
        padding-right: 36px;
        background-size: 14px;
        background-position: right 10px center;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ccd-select {
        border-width: 3px;
        border-color: hsl(0 0% 0%); /* #000000 */
    }
    
    .ccd-select:focus {
        border-color: hsl(212 92% 43%); /* #0073aa */
        box-shadow: 0 0 0 3px hsl(212 92% 43%); /* #0073aa */
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ccd-select,
    .ccd-subcategory-wrapper,
    .ccd-spinner {
        transition: none;
        animation: none;
    }
}

/* RTL support */
[dir="rtl"] .ccd-select {
    background-position: left 12px center;
    padding-right: 16px;
    padding-left: 40px;
}

[dir="rtl"] @media (max-width: 480px) {
    .ccd-select {
        background-position: left 10px center;
        padding-right: 14px;
        padding-left: 36px;
    }
}
