/**
 * Reviews Form Upload CSS
 * Premium file upload, image preview, submit button
 * 
 * Uses brand tokens & consistent borders
 */

/* [CTX:REVIEW_FORM_UPLOAD:INPUT] */
/* Hidden file input */
#review_images {
    display: none;
}

/* [CTX:REVIEW_FORM_UPLOAD:UPLOAD_CONTROL] */
/* =====================================================================
   FILE UPLOAD CONTAINER
   ===================================================================== */

.file-upload-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
}

.review-upload-heading {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    color: var(--brand-text-color-headers);
    font-family: var(--brand-font-family);
    font-size: var(--font-size-base);
    font-weight: 700;
}

.review-upload-heading strong {
    padding: var(--space-1) var(--space-3);
    color: var(--brand-color-primary);
    background: var(--brand-color-surface-sand);
    border: 1px solid var(--brand-color-border-sand);
    border-radius: var(--brand-radius-lg);
    font-size: var(--font-size-base);
    line-height: 1.2;
}

.review-photo-upload {
    width: 100%;
}

.review-photo-upload__control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-4);
    border: 1px dashed var(--brand-color-border-accent);
    border-radius: var(--brand-radius-sm);
    background: var(--brand-color-surface);
    cursor: pointer;
    transition: border-color var(--transition-base), background var(--transition-base);
    box-sizing: border-box;
}

.review-photo-upload__control:hover {
    border-color: var(--brand-color-primary);
    background: var(--brand-color-surface-alt);
}

.review-photo-upload__control:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.review-photo-upload__slots {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
}

.review-photo-slot {
    position: relative;
    aspect-ratio: 1;
    border: 1px dashed var(--brand-color-border-accent);
    border-radius: var(--brand-radius-sm);
    background: var(--brand-color-surface-alt);
    overflow: hidden;
}

.review-photo-slot__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--brand-color-primary);
}

.review-photo-slot__placeholder svg {
    width: var(--space-6);
    height: var(--space-6);
}

.review-photo-slot__filled {
    position: relative;
    width: 100%;
    height: 100%;
}

.review-photo-slot__filled img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.review-photo-slot__remove {
    position: absolute;
    top: var(--space-1);
    right: var(--space-1);
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--brand-color-surface);
    color: var(--brand-text-color-muted);
    font-size: var(--font-size-base);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition-base), color var(--transition-base), transform var(--transition-fast);
}

.review-photo-slot__remove:hover {
    background: var(--brand-color-primary);
    color: var(--brand-text-color-on-primary);
}

.review-photo-slot__remove:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.review-photo-slot__remove:active {
    transform: scale(0.98);
}

.review-photo-upload__count {
    flex-shrink: 0;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--brand-color-border-subtle);
    border-radius: var(--brand-radius-lg);
    background: var(--brand-color-surface);
    color: var(--brand-text-color-muted);
    font-family: var(--brand-font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.2;
}

.custom-file-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--brand-color-surface);
    border: 1px solid var(--brand-color-primary);
    border-radius: var(--brand-radius-lg);
    overflow: hidden;
    color: var(--brand-color-primary);
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base), transform var(--transition-fast);
    text-decoration: none;
    user-select: none;
    box-sizing: border-box;
    flex-shrink: 0;
    font-family: var(--brand-font-family);
    font-size: var(--font-size-base);
    font-weight: 600;
    min-height: 48px;
}

.custom-file-upload:hover {
    background: var(--brand-color-surface-alt);
    border-color: var(--brand-color-primary-600);
}

.custom-file-upload:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.custom-file-upload:active {
    transform: scale(0.98);
}

.file-upload-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    flex-shrink: 0;
}

.file-upload-text {
    white-space: nowrap;
    line-height: 1.2;
}

.file-count-text {
    font-family: var(--brand-font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--brand-text-color-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* [CTX:REVIEW_FORM_UPLOAD:IMAGE_PREVIEW] */
/* =====================================================================
   IMAGE PREVIEW
   ===================================================================== */

.image-preview {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding: var(--space-4);
    background: var(--brand-color-surface-alt);
    border: 1px solid var(--brand-color-border-accent);
    border-radius: var(--brand-radius-lg);
    overflow: hidden;
}

.image-preview.has-images {
    display: grid;
}

/* Safety: ascunde preview-ul dacă nu are copii (fallback CSS) */
.image-preview.has-images:empty {
    display: none;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--brand-radius-sm);
    overflow: hidden;
    border: 1px solid var(--brand-color-border-accent);
    transition: all var(--transition-base);
    background: var(--brand-color-surface);
}

.image-preview-item:hover {
    border-color: var(--brand-color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: var(--space-1);
    right: var(--space-1);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: 700;
    line-height: 1;
    color: var(--brand-text-color-muted);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-image:hover {
    background: var(--brand-color-primary);
    color: var(--brand-text-color-on-primary);
    transform: scale(1.15);
    box-shadow: var(--shadow-md);
}

.remove-image:focus-visible {
    outline: 2px solid var(--brand-color-primary);
    outline-offset: 2px;
}

.remove-image:active {
    transform: scale(1.05);
}

/* [CTX:REVIEW_FORM_UPLOAD:SUBMIT_CTA] */
/* =====================================================================
   SUBMIT BUTTON
   ===================================================================== */

.form-actions {
    margin-top: var(--space-4);
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.submit-review-btn {
    background: var(--brand-color-primary);
    color: var(--brand-text-color-on-primary);
    border: none;
    padding: var(--space-4) var(--space-8);
    border-radius: var(--brand-radius-lg);
    overflow: hidden;
    font-size: var(--font-size-lg);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-base), transform var(--transition-fast), box-shadow var(--transition-base);
    font-family: var(--brand-font-family);
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-md);
}

.submit-review-btn:hover {
    background: var(--brand-color-primary-600);
}

.submit-review-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring), var(--shadow-md);
}

.submit-review-btn:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

.submit-review-btn:disabled {
    background: var(--brand-text-color-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-review-btn__icon {
    width: var(--space-5);
    height: var(--space-5);
    flex-shrink: 0;
}

.submit-review-btn__label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

/* Loading spinner */
.submit-review-btn:disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid transparent;
    border-top: 2px solid var(--brand-text-color-on-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* [CTX:REVIEW_FORM_UPLOAD:RESPONSIVE] */
/* =====================================================================
   RESPONSIVE
   ===================================================================== */

@media (max-width: 768px) {
    .review-photo-upload__control {
        padding: var(--space-3);
        gap: var(--space-2);
    }

    .review-photo-upload__count {
        font-size: var(--font-size-xs);
    }
    
    .submit-review-btn {
        width: 100%;
        padding: var(--space-5) var(--space-6);
        font-size: var(--font-size-lg);
    }
}

@media (max-width: 480px) {
    .review-photo-upload__control {
        flex-direction: column;
        align-items: stretch;
    }

    .review-photo-upload__count {
        align-self: flex-end;
    }

    .review-photo-slot__remove {
        width: 22px;
        height: 22px;
        font-size: var(--font-size-sm);
    }
    
    .submit-review-btn {
        padding: var(--space-3);
        font-size: var(--font-size-lg);
    }
}
