/**
 * Upload Page Styles - Coran 3D
 * Ultra Simple Video Upload Interface
 * ===================================
 */

/* =============================================
   PAGE CONTAINER
   ============================================= */

.upload-page {
    min-height: 100vh;
    padding: var(--space-6) var(--space-8);
    background: var(--bg-primary);
    max-width: 1000px;
    margin: 0 auto;
}

/* =============================================
   HEADER
   ============================================= */

.upload-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.upload-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-back:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.upload-back svg {
    width: 20px;
    height: 20px;
}

.upload-header__title h1 {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.upload-header__title h1 svg {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

.upload-header__title span {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* =============================================
   CONTAINER
   ============================================= */

.upload-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
}

.upload-col-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.upload-image-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.upload-image-section .upload-label {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .upload-container {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   LOADING
   ============================================= */

.upload-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: var(--space-4);
}

.upload-loading__spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =============================================
   SOURCE TOGGLE (Upload/URL)
   ============================================= */

.upload-source {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.upload-mode-toggle {
    display: flex;
    gap: var(--space-1);
    background: var(--bg-secondary);
    padding: var(--space-1);
    border-radius: var(--radius-lg);
}

.upload-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-mode-btn svg {
    width: 16px;
    height: 16px;
}

.upload-mode-btn:hover {
    color: var(--text-secondary);
}

.upload-mode-btn--active {
    background: var(--bg-card);
    color: var(--accent-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* URL Input */
.upload-url-input {
    display: flex;
    gap: var(--space-2);
}

.upload-url-input .upload-input {
    flex: 1;
}

.upload-url-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--bg-primary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-url-btn:hover {
    background: var(--ochre);
}

.upload-url-btn svg {
    width: 20px;
    height: 20px;
}

.upload-url-help {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-align: center;
}

.upload-file-preview__url {
    word-break: break-all;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =============================================
   DROPZONE
   ============================================= */

.upload-dropzone {
    background: var(--bg-card);
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-default);
}

.upload-dropzone:hover,
.upload-dropzone--dragover {
    border-color: var(--accent-primary);
    background: rgba(212, 175, 125, 0.05);
}

.upload-dropzone--dragover {
    transform: scale(1.02);
}

.upload-dropzone__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.upload-dropzone__icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 175, 125, 0.1);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-4);
}

.upload-dropzone__icon svg {
    width: 40px;
    height: 40px;
    color: var(--accent-primary);
}

.upload-dropzone__text {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.upload-dropzone__subtext {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.upload-dropzone__btn {
    padding: var(--space-3) var(--space-6);
    background: var(--accent-primary);
    color: var(--bg-primary);
    font-size: var(--text-sm);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-dropzone__btn:hover {
    background: var(--ochre);
    transform: translateY(-1px);
}

.upload-dropzone__formats {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-4);
}

/* Selected File */
.upload-dropzone--selected {
    border-style: solid;
    border-color: var(--accent-primary);
    cursor: default;
}

.upload-file-preview {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    width: 100%;
}

.upload-file-preview__icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 175, 125, 0.15);
    border-radius: var(--radius-lg);
}

.upload-file-preview__icon svg {
    width: 32px;
    height: 32px;
    color: var(--accent-primary);
}

.upload-file-preview__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.upload-file-preview__name {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.upload-file-preview__size {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.upload-file-preview__remove {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border: none;
    border-radius: var(--radius-md);
    color: #ef4444;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-file-preview__remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

.upload-file-preview__remove svg {
    width: 18px;
    height: 18px;
}

/* Uploading State */
.upload-dropzone--uploading {
    cursor: default;
    border-style: solid;
    border-color: var(--accent-primary);
}

.upload-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-progress__circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: var(--space-4);
}

.upload-progress__circle svg {
    width: 100%;
    height: 100%;
}

.upload-progress__circle circle:last-child {
    transition: stroke-dashoffset 0.3s ease;
}

.upload-progress__percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--accent-primary);
}

.upload-progress__text {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.upload-progress__file {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Encoding State */
.upload-dropzone--encoding {
    cursor: default;
    border-style: solid;
    border-color: #35b244;
}

.upload-encoding {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-encoding__success {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(53, 178, 68, 0.15);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-4);
}

.upload-encoding__success svg {
    width: 40px;
    height: 40px;
    color: #35b244;
}

.upload-encoding__error {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.15);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-4);
}

.upload-encoding__error svg {
    width: 40px;
    height: 40px;
    color: #ef4444;
}

.upload-encoding__progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.upload-encoding__spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.upload-encoding__progress span {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--accent-primary);
}

.upload-encoding__text {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.upload-encoding__thumb {
    width: 200px;
    height: auto;
    border-radius: var(--radius-lg);
    margin-top: var(--space-4);
}

/* =============================================
   FORM
   ============================================= */

.upload-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.upload-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.upload-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.upload-input,
.upload-textarea,
.upload-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-input:focus,
.upload-textarea:focus,
.upload-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.upload-input::placeholder,
.upload-textarea::placeholder {
    color: var(--text-muted);
}

.upload-textarea {
    resize: vertical;
    min-height: 80px;
}

.upload-select {
    cursor: pointer;
}

.upload-select-wrapper {
    display: flex;
    gap: var(--space-2);
}

.upload-select-wrapper .upload-select {
    flex: 1;
}

.upload-select-add {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-select-add:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.upload-select-add svg {
    width: 18px;
    height: 18px;
}

/* New Collection Form */
.upload-new-collection {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.upload-new-collection .upload-input {
    flex: 1;
}

.upload-select--small {
    width: auto;
    min-width: 120px;
}

/* =============================================
   IMAGE UPLOAD ZONE
   ============================================= */

.upload-image-zone {
    background: var(--bg-card);
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    max-height: 180px;
}

.upload-image-zone:hover,
.upload-image-zone--dragover {
    border-color: var(--accent-primary);
    background: rgba(212, 175, 125, 0.05);
}

.upload-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--space-2);
    color: var(--text-muted);
}

.upload-image-placeholder svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.upload-image-placeholder span {
    font-size: var(--text-sm);
}

.upload-image-preview {
    position: relative;
    width: 100%;
    height: 100%;
}

.upload-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-image-preview__remove {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-image-preview__remove:hover {
    background: rgba(239, 68, 68, 0.9);
}

.upload-image-preview__remove svg {
    width: 16px;
    height: 16px;
}

/* =============================================
   TAGS
   ============================================= */

.upload-tags {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.upload-tags__selected {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.upload-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: rgba(212, 175, 125, 0.15);
    color: var(--accent-primary);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
}

.upload-tag button {
    background: none;
    border: none;
    color: inherit;
    font-size: var(--text-base);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.upload-tag button:hover {
    opacity: 1;
}

.upload-tags__input {
    flex: 1;
    min-width: 120px;
    border: none;
    background: transparent;
    padding: var(--space-1);
    font-size: var(--text-sm);
    color: var(--text-primary);
    outline: none;
}

.upload-tags__input::placeholder {
    color: var(--text-muted);
}

.upload-tags__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: var(--space-2);
}

.upload-tag-suggestion {
    padding: var(--space-1) var(--space-2);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-tag-suggestion:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* =============================================
   LEVELS (Style tag compact)
   ============================================= */

.upload-levels {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.upload-label small {
    font-weight: 400;
    color: var(--text-muted);
}

.upload-level {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    font-size: var(--text-xs);
}

.upload-level:hover {
    border-color: var(--accent-soft);
}

.upload-level--selected {
    border-color: var(--accent-primary);
    background: rgba(212, 175, 125, 0.15);
    color: var(--accent-primary);
}

.upload-level input {
    display: none;
}

.upload-level__name {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-secondary);
}

.upload-level--selected .upload-level__name {
    color: var(--accent-primary);
}

/* =============================================
   PUBLICATION TOGGLE
   ============================================= */

.upload-publish-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.upload-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.upload-toggle input {
    display: none;
}

.upload-toggle__slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-toggle__slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-toggle input:checked + .upload-toggle__slider {
    background: var(--accent-primary);
}

.upload-toggle input:checked + .upload-toggle__slider::after {
    left: 22px;
    background: var(--bg-primary);
}

.upload-toggle__label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.upload-toggle input:checked ~ .upload-toggle__label {
    color: var(--accent-primary);
}

.upload-publish-date {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
}

.upload-input--date {
    max-width: 220px;
    font-size: var(--text-xs);
}

.upload-publish-hint {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(212, 175, 125, 0.15);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

/* =============================================
   BUTTONS
   ============================================= */

.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.upload-btn--primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
}

.upload-btn--primary:hover:not(:disabled) {
    background: var(--ochre);
    transform: translateY(-1px);
}

.upload-btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upload-btn--secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.upload-btn--secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.upload-btn--small {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

.upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--space-4);
}

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

@media (max-width: 768px) {
    .upload-page {
        padding: var(--space-4);
    }

    .upload-header {
        flex-wrap: wrap;
    }

    .upload-dropzone {
        min-height: 250px;
        padding: var(--space-6);
    }

    .upload-levels {
        flex-direction: column;
    }

    .upload-level {
        width: 100%;
    }
}
