/* ===== IMAGE UPLOAD COMPONENT - Material Design 3 ===== */

/* Specialty Selection Chips */
.md-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.md-specialty-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.md-specialty-chip:hover {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.md-specialty-chip md-icon {
    font-size: 18px;
    margin-left: 4px;
}

/* Unified Image Upload Container */
.md-image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 100%;
}

/* Unified Upload Zone */
.md-upload-zone-unified {
    position: relative;
    min-height: 140px;
    max-width: 600px;
    margin: 0 auto;
    border: 2px dashed var(--md-sys-color-outline);
    border-radius: 16px;
    background: linear-gradient(135deg, 
        var(--md-sys-color-surface-container-lowest) 0%, 
        var(--md-sys-color-surface-container-low) 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.md-upload-zone-unified:hover {
    border-color: var(--md-sys-color-primary);
    background: linear-gradient(135deg, 
        var(--md-sys-color-primary-container) 0%, 
        var(--md-sys-color-secondary-container) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.md-upload-zone-unified.dragover {
    border-color: var(--md-sys-color-primary);
    border-width: 3px;
    background: var(--md-sys-color-primary-container);
    transform: scale(1.01);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.md-upload-zone-unified.has-files {
    border-style: solid;
    border-color: var(--md-sys-color-primary);
    background: linear-gradient(135deg, 
        var(--md-sys-color-surface-container) 0%, 
        var(--md-sys-color-surface-container-high) 100%);
    min-height: 100px;
}

/* Upload Zone Content */
.md-upload-content {
    padding: 24px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 2;
    position: relative;
    width: 100%;
}

.md-upload-icon {
    font-size: 48px;
    color: var(--md-sys-color-primary);
    transition: all 0.3s ease;
    opacity: 0.8;
}

.md-upload-zone-unified:hover .md-upload-icon {
    transform: scale(1.1) rotate(3deg);
    opacity: 1;
    color: var(--md-sys-color-on-primary-container);
}

.md-upload-zone-unified.dragover .md-upload-icon {
    transform: scale(1.15) rotate(-3deg);
    color: var(--md-sys-color-on-primary-container);
    opacity: 1;
}

.md-upload-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.md-upload-decoration {
    position: absolute;
    top: -10px;
    right: -10px;
    opacity: 0.6;
}

.md-upload-dots {
    display: flex;
    gap: 4px;
    animation: dotsFloat 2s ease-in-out infinite;
}

.md-upload-dots span {
    width: 6px;
    height: 6px;
    background: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: dotsBounce 1.5s ease-in-out infinite;
}

.md-upload-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.md-upload-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.md-upload-grid-preview {
    display: grid;
    grid-template-columns: repeat(2, 12px);
    grid-template-rows: repeat(2, 12px);
    gap: 2px;
    opacity: 0.5;
}

.md-preview-placeholder {
    background: var(--md-sys-color-primary);
    border-radius: 2px;
    animation: placeholderPulse 2s ease-in-out infinite;
}

.md-preview-placeholder:nth-child(2) {
    animation-delay: 0.3s;
}

.md-preview-placeholder:nth-child(3) {
    animation-delay: 0.6s;
}

.md-preview-placeholder:nth-child(4) {
    animation-delay: 0.9s;
}

.md-upload-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.md-upload-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    line-height: 1.3;
    margin-bottom: 4px;
}

.md-upload-subtitle {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.4;
    opacity: 0.8;
    max-width: 500px;
}

.md-upload-zone-unified:hover .md-upload-title {
    color: var(--md-sys-color-on-primary-container);
}

.md-upload-zone-unified:hover .md-upload-subtitle {
    color: var(--md-sys-color-on-primary-container);
    opacity: 0.9;
}

.md-upload-formats {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.md-upload-zone-unified:hover .md-upload-formats {
    color: var(--md-sys-color-on-primary-container);
    opacity: 0.8;
}

.md-upload-button {
    margin-top: 12px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.md-upload-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* File Input (Hidden) */
.md-upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
}

/* Images Gallery */
.md-images-gallery {
    margin-top: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.md-images-gallery.visible {
    opacity: 1;
    transform: translateY(0);
}

.md-gallery-header {
    text-align: center;
    margin-bottom: 20px;
}

.md-gallery-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin: 0 0 8px 0;
}

.md-gallery-subtitle {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
    opacity: 0.8;
}

.md-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.md-gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: var(--md-sys-color-surface-container);
}

.md-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.md-gallery-item.main-image {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 4px 16px rgba(var(--md-sys-color-primary-rgb), 0.3);
}

.md-gallery-item.main-image:hover {
    box-shadow: 0 8px 24px rgba(var(--md-sys-color-primary-rgb), 0.4);
}

.md-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.md-gallery-item:hover .md-gallery-image {
    transform: scale(1.05);
}

.md-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0.1) 0%, 
        rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.md-gallery-item:hover .md-gallery-overlay {
    opacity: 1;
}

.md-gallery-item.main-image .md-gallery-overlay {
    opacity: 1;
    background: linear-gradient(to bottom, 
        rgba(var(--md-sys-color-primary-rgb), 0.2) 0%, 
        rgba(var(--md-sys-color-primary-rgb), 0.4) 100%);
}

.md-main-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.md-remove-button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

.md-gallery-item:hover .md-remove-button {
    opacity: 1;
    transform: scale(1);
}

.md-remove-button:hover {
    background: var(--md-sys-color-error);
    transform: scale(1.1);
}

.md-select-main-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.md-gallery-item:not(.main-image):hover .md-select-main-hint {
    opacity: 1;
}

/* Toast Notifications */
.md-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
}

.md-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.md-toast-success {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.md-toast-error {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.md-toast-warning {
    background: var(--md-sys-color-tertiary);
    color: var(--md-sys-color-on-tertiary);
}

.md-toast-info {
    background: var(--md-sys-color-secondary);
    color: var(--md-sys-color-on-secondary);
}

.md-toast md-icon {
    font-size: 18px;
}

/* Upload Errors Container */
.md-upload-errors {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.md-upload-errors .md-field-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    border-radius: 8px;
    font-size: 14px;
    border-left: 4px solid var(--md-sys-color-error);
    animation: errorSlideIn 0.3s ease;
}

.md-upload-errors .md-field-error md-icon {
    font-size: 20px;
    color: var(--md-sys-color-error);
    flex-shrink: 0;
}

@keyframes errorSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Image Previews */
.md-images-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 16px;
    padding: 16px;
    background: var(--md-sys-color-surface-container-lowest);
    border-radius: 12px;
}

.md-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline-variant);
    transition: transform 0.2s ease;
}

.md-preview-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.md-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.md-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    opacity: 0;
    transform: scale(0.8);
}

.md-preview-item:hover .md-preview-remove {
    opacity: 1;
    transform: scale(1);
}

.md-preview-remove:hover {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    transform: scale(1.1);
}

/* Main Image Indicator */
.md-preview-main {
    border: 2px solid var(--md-sys-color-primary);
    position: relative;
}

.md-preview-main::after {
    content: 'Principal';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--md-sys-color-primary), transparent);
    color: var(--md-sys-color-on-primary);
    font-size: 12px;
.md-upload-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-radius: 12px;
    font-size: 14px;
    margin-top: 12px;
}

.md-upload-notice md-icon {
    font-size: 20px;
}

/* ... rest of the code remains the same ... */
.md-upload-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--md-sys-color-surface), 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Progress Bar */
.md-upload-progress {
    width: 100%;
    height: 4px;
    background: var(--md-sys-color-surface-variant);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 16px;
}

.md-upload-progress-bar {
    height: 100%;
    background: var(--md-sys-color-primary);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .md-image-upload-container {
        gap: 20px;
    }
    
    .md-upload-zone-unified {
        min-height: 120px;
        max-width: 100%;
        margin: 0;
    }
    
    .md-upload-content {
        padding: 20px 16px;
        gap: 12px;
    }
    
    .md-upload-icon {
        font-size: 40px;
    }
    
    .md-upload-title {
        font-size: 16px;
    }
    
    .md-upload-subtitle {
        font-size: 13px;
    }
    
    .md-upload-button {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .md-upload-formats {
        font-size: 10px;
    }
    
    .md-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .md-gallery-title {
        font-size: 16px;
    }
    
    .md-gallery-subtitle {
        font-size: 13px;
    }
    
    .md-toast {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
        font-size: 13px;
    }
    
    .md-upload-errors .md-field-error {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .md-upload-errors .md-field-error md-icon {
        font-size: 18px;
    }
    

}

/* Animations */
@keyframes dropAnimation {
    0% { 
        transform: scale(1) rotate(0deg); 
        border-width: 3px;
    }
    50% { 
        transform: scale(1.05) rotate(1deg); 
        border-width: 4px;
    }
    100% { 
        transform: scale(1) rotate(0deg); 
        border-width: 3px;
    }
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.md-upload-zone.drop-animation {
    animation: dropAnimation 0.4s ease;
}

.md-upload-zone.drop-animation .md-upload-icon {
    animation: iconBounce 0.4s ease;
}

/* Pulse effect for empty zones */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(var(--md-sys-color-primary-rgb), 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(var(--md-sys-color-primary-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--md-sys-color-primary-rgb), 0); }
}

.md-upload-zone:not(.has-files):hover {
    animation: pulse 2s infinite;
}

/* Visual decoration animations */
@keyframes dotsFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes dotsBounce {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

@keyframes placeholderPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* Enhanced hover effects for decorations */
.md-upload-zone:hover .md-upload-decoration {
    opacity: 1;
    transform: scale(1.1);
}

.md-upload-zone.dragover .md-upload-decoration {
    opacity: 1;
    transform: scale(1.2) rotate(5deg);
}


