/**
 * File Upload Widget Styles
 *
 * Complete styling for file upload UI component with:
 * - Drag & Drop zone
 * - File list with thumbnails/icons
 * - Progress indicators
 * - Status feedback
 * - Dark mode support
 * - Responsive design
 *
 * @package Framework\LiveComponents
 */

@layer components {
    /* ===== Widget Container ===== */
    .file-upload-widget {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }

    /* ===== Drop Zone ===== */
    .file-upload-dropzone {
        position: relative;
        border: 2px dashed oklch(70% 0.05 280);
        border-radius: 0.75rem;
        padding: 2rem;
        text-align: center;
        background: oklch(98% 0.01 280);
        transition: all 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
        cursor: pointer;
    }

    .file-upload-dropzone:hover {
        border-color: oklch(60% 0.15 280);
        background: oklch(96% 0.02 280);
    }

    .file-upload-dropzone.drag-over,
    .file-upload-dropzone.drag-active {
        border-color: oklch(60% 0.25 280);
        background: oklch(95% 0.08 280 / 0.5);
        transform: scale(1.02);
    }

    .dropzone-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        pointer-events: none; /* Allow drag events to pass through */
    }

    .dropzone-icon {
        color: oklch(60% 0.15 280);
        opacity: 0.7;
    }

    .file-upload-dropzone:hover .dropzone-icon,
    .file-upload-dropzone.drag-over .dropzone-icon {
        opacity: 1;
        color: oklch(60% 0.25 280);
    }

    .dropzone-text {
        margin: 0;
        color: oklch(40% 0.05 280);
        font-size: 1rem;
        font-weight: 500;
    }

    .dropzone-button {
        pointer-events: auto;
        padding: 0.5rem 1.5rem;
        border-radius: 0.5rem;
        background: oklch(60% 0.25 280);
        color: white;
        border: none;
        cursor: pointer;
        font-weight: 500;
        transition: all 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
    }

    .dropzone-button:hover {
        background: oklch(55% 0.25 280);
        transform: translateY(-2px);
    }

    .dropzone-button:active {
        transform: translateY(0);
    }

    .dropzone-input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    /* ===== File List ===== */
    .file-upload-list {
        margin-top: 1.5rem;
        border: 1px solid oklch(85% 0.02 280);
        border-radius: 0.75rem;
        padding: 1rem;
        background: oklch(99% 0.005 280);
    }

    .file-list-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid oklch(90% 0.02 280);
    }

    .file-list-header h4 {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
        color: oklch(30% 0.05 280);
    }

    .file-list-actions {
        display: flex;
        gap: 0.5rem;
    }

    .file-list-items {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    /* ===== File Item ===== */
    .file-item {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 1rem;
        align-items: start;
        padding: 0.75rem;
        border: 1px solid oklch(90% 0.02 280);
        border-radius: 0.5rem;
        background: white;
        transition: all 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
    }

    .file-item:hover {
        border-color: oklch(80% 0.05 280);
        box-shadow: 0 2px 8px oklch(50% 0.05 280 / 0.08);
    }

    /* File item states */
    .file-item.file-uploading {
        border-color: oklch(60% 0.25 280);
        background: oklch(98% 0.08 280 / 0.3);
    }

    .file-item.file-complete {
        border-color: oklch(70% 0.15 140);
        background: oklch(98% 0.08 140 / 0.2);
    }

    .file-item.file-error {
        border-color: oklch(65% 0.2 30);
        background: oklch(98% 0.08 30 / 0.2);
    }

    /* ===== File Preview ===== */
    .file-preview {
        width: 56px;
        height: 56px;
        border-radius: 0.375rem;
        overflow: hidden;
        background: oklch(95% 0.02 280);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .file-thumbnail {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .file-icon {
        color: oklch(60% 0.1 280);
    }

    /* ===== File Info ===== */
    .file-info {
        flex: 1;
        min-width: 0; /* Allow text truncation */
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .file-name {
        font-weight: 500;
        color: oklch(25% 0.05 280);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .file-meta {
        display: flex;
        gap: 0.75rem;
        align-items: center;
        font-size: 0.875rem;
        color: oklch(50% 0.05 280);
    }

    .file-status {
        font-weight: 500;
    }

    .file-status[data-status="pending"] {
        color: oklch(50% 0.1 280);
    }

    .file-status[data-status="uploading"] {
        color: oklch(60% 0.25 280);
    }

    .file-status[data-status="complete"] {
        color: oklch(60% 0.15 140);
    }

    .file-status[data-status="error"] {
        color: oklch(55% 0.2 30);
    }

    .file-error {
        margin-top: 0.25rem;
        padding: 0.5rem;
        background: oklch(98% 0.08 30 / 0.3);
        border-radius: 0.25rem;
        font-size: 0.875rem;
        color: oklch(45% 0.15 30);
    }

    /* ===== File Progress ===== */
    .file-progress {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .file-progress-bar {
        flex: 1;
        height: 4px;
        background: oklch(90% 0.02 280);
        border-radius: 2px;
        overflow: hidden;
    }

    .file-progress-fill {
        height: 100%;
        background: oklch(60% 0.25 280);
        border-radius: 2px;
        transition: width 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
    }

    .file-progress-text {
        font-size: 0.75rem;
        font-weight: 600;
        color: oklch(50% 0.1 280);
        min-width: 3ch;
        text-align: right;
    }

    /* ===== File Actions ===== */
    .file-actions {
        display: flex;
        gap: 0.25rem;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
        padding: 0.5rem;
        border: none;
        background: transparent;
        border-radius: 0.25rem;
        color: oklch(50% 0.05 280);
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-icon:hover {
        background: oklch(95% 0.02 280);
        color: oklch(40% 0.1 280);
    }

    .btn-icon:active {
        transform: scale(0.95);
    }

    /* ===== Overall Progress ===== */
    .file-upload-progress {
        margin-top: 1rem;
        padding: 1rem;
        border: 1px solid oklch(85% 0.02 280);
        border-radius: 0.5rem;
        background: oklch(99% 0.005 280);
    }

    .progress-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
    }

    .progress-label {
        font-weight: 500;
        color: oklch(30% 0.05 280);
    }

    .progress-percentage {
        font-weight: 600;
        color: oklch(60% 0.25 280);
        font-size: 0.875rem;
    }

    .progress-bar {
        height: 8px;
        background: oklch(90% 0.02 280);
        border-radius: 4px;
        overflow: hidden;
    }

    .progress-fill {
        height: 100%;
        background: linear-gradient(90deg, oklch(60% 0.25 280), oklch(70% 0.25 280));
        border-radius: 4px;
        transition: width 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
    }

    /* ===== Button Styles ===== */
    .btn {
        padding: 0.5rem 1rem;
        border-radius: 0.375rem;
        font-weight: 500;
        font-size: 0.875rem;
        cursor: pointer;
        border: none;
        transition: all 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
    }

    .btn-primary {
        background: oklch(60% 0.25 280);
        color: white;
    }

    .btn-primary:hover {
        background: oklch(55% 0.25 280);
        transform: translateY(-1px);
    }

    .btn-secondary {
        background: oklch(90% 0.02 280);
        color: oklch(40% 0.05 280);
    }

    .btn-secondary:hover {
        background: oklch(85% 0.05 280);
    }

    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }

    .btn:active {
        transform: translateY(0);
    }

    /* ===== Dark Mode Support ===== */
    @media (prefers-color-scheme: dark) {
        .file-upload-dropzone {
            border-color: oklch(40% 0.05 280);
            background: oklch(25% 0.02 280);
        }

        .file-upload-dropzone:hover,
        .file-upload-dropzone.drag-over {
            border-color: oklch(60% 0.25 280);
            background: oklch(30% 0.08 280);
        }

        .dropzone-text {
            color: oklch(75% 0.05 280);
        }

        .file-upload-list {
            border-color: oklch(35% 0.02 280);
            background: oklch(22% 0.02 280);
        }

        .file-list-header {
            border-bottom-color: oklch(30% 0.02 280);
        }

        .file-list-header h4 {
            color: oklch(85% 0.05 280);
        }

        .file-item {
            border-color: oklch(30% 0.02 280);
            background: oklch(25% 0.02 280);
        }

        .file-item:hover {
            border-color: oklch(40% 0.05 280);
        }

        .file-preview {
            background: oklch(30% 0.02 280);
        }

        .file-name {
            color: oklch(85% 0.05 280);
        }

        .file-meta {
            color: oklch(65% 0.05 280);
        }

        .file-error {
            background: oklch(35% 0.08 30 / 0.3);
            color: oklch(75% 0.15 30);
        }

        .file-progress-bar {
            background: oklch(30% 0.02 280);
        }

        .file-upload-progress {
            border-color: oklch(35% 0.02 280);
            background: oklch(22% 0.02 280);
        }

        .progress-label {
            color: oklch(85% 0.05 280);
        }

        .progress-bar {
            background: oklch(30% 0.02 280);
        }

        .btn-secondary {
            background: oklch(30% 0.02 280);
            color: oklch(80% 0.05 280);
        }

        .btn-secondary:hover {
            background: oklch(35% 0.05 280);
        }

        .btn-icon:hover {
            background: oklch(30% 0.02 280);
            color: oklch(80% 0.1 280);
        }
    }

    /* ===== Responsive Design ===== */
    @media (max-width: 640px) {
        .file-upload-widget {
            max-width: 100%;
        }

        .file-upload-dropzone {
            padding: 1.5rem 1rem;
        }

        .dropzone-text {
            font-size: 0.875rem;
        }

        .file-item {
            grid-template-columns: auto 1fr;
            gap: 0.75rem;
        }

        .file-actions {
            grid-column: 1 / -1;
            justify-content: flex-end;
            padding-top: 0.5rem;
            border-top: 1px solid oklch(90% 0.02 280);
        }

        @media (prefers-color-scheme: dark) {
            .file-actions {
                border-top-color: oklch(30% 0.02 280);
            }
        }

        .file-list-header {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.75rem;
        }

        .file-list-actions {
            width: 100%;
        }

        .file-list-actions .btn {
            flex: 1;
        }
    }

    /* ===== Animations ===== */
    @keyframes upload-pulse {
        0%, 100% {
            opacity: 1;
        }
        50% {
            opacity: 0.7;
        }
    }

    .file-item.file-uploading .file-progress-fill {
        animation: upload-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }

    /* ===== Reduced Motion Support ===== */
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}
