* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #f0f9ff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 8px;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding: 15px;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

header p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.file-size-warning {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    margin: 10px auto;
    max-width: 200px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

main {
    padding: 1.5rem;
}

.upload-section {
    text-align: center;
}

.upload-section h2 {
    margin-bottom: 1rem;
    color: var(--primary);
    font-size: 1.5rem;
}

.upload-section > p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.supported-formats {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
    text-align: left;
    background: var(--secondary);
    padding: 1.2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.format-group {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.format-group i {
    color: var(--primary);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.format-group span {
    flex: 1;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    margin: 1.5rem 0;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--secondary);
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: #e0f2fe;
    transform: translateY(-2px);
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-area p {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.upload-area span {
    display: block;
    margin: 0.5rem 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

.browse-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.9rem 1.8rem;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    min-height: 48px;
}

.browse-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.file-info {
    display: none;
    flex-direction: column;
    gap: 1.2rem;
    margin: 1.8rem 0;
    padding: 1.2rem;
    background-color: var(--secondary);
    border-radius: var(--radius);
    text-align: left;
    border: 1px solid var(--border);
}

.file-preview {
    width: 140px;
    height: 140px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    margin: 0 auto;
}

.file-preview img,
.file-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.audio-preview,
.file-preview-default {
    text-align: center;
    padding: 1rem;
    width: 100%;
}

.audio-preview audio,
.file-preview audio {
    width: 100%;
    margin-top: 0.5rem;
}

.file-details {
    width: 100%;
}

.file-details p {
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.file-details strong {
    color: var(--text);
    min-width: 80px;
    text-align: left;
}

.file-details span {
    color: var(--text-light);
    text-align: right;
    flex: 1;
}

#fileStatus {
    font-weight: 600;
    font-size: 0.9rem;
}

.progress-container {
    display: none;
    margin: 1.8rem 0;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: var(--border);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.8rem;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 5px;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
    text-align: center;
}

.upload-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1.1rem 2.5rem;
    border-radius: var(--radius);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    max-width: 280px;
    font-weight: 600;
    box-shadow: var(--shadow);
    display: block;
    margin: 0 auto;
    min-height: 52px;
}

.upload-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
}

.upload-btn:disabled {
    background: var(--border);
    color: var(--text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.result-section {
    display: none;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-section h2 {
    margin-bottom: 1.8rem;
    color: var(--success);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.result-container {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.8rem;
}

.uploaded-media {
    width: 100%;
    max-width: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    background: var(--secondary);
    border-radius: var(--radius);
    padding: 1rem;
    border: 2px solid var(--border);
}

.uploaded-media img,
.uploaded-media video {
    width: 100%;
    max-height: 350px;
    border-radius: var(--radius);
    object-fit: contain;
}

.uploaded-media audio {
    width: 100%;
    max-width: 280px;
}

.uploaded-media #unsupportedMedia {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
}

.uploaded-media #unsupportedMedia i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.url-container {
    width: 100%;
    max-width: 350px;
    text-align: center;
}

.url-container p {
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.url-box {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.url-box input {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    background-color: #f8fafc;
    font-size: 0.9rem;
    color: var(--text);
    border-radius: var(--radius);
    width: 100%;
}

.url-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.url-box button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.9rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius);
    width: 100%;
    min-height: 48px;
}

.url-box button:hover {
    background-color: var(--primary-dark);
}

.view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--success);
    color: white;
    text-decoration: none;
    padding: 0.9rem 1.8rem;
    border-radius: var(--radius);
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    min-height: 48px;
}

.view-btn:hover {
    background-color: #0da271;
    transform: translateY(-2px);
}

.new-upload-btn {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.9rem 1.8rem;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    min-height: 48px;
}

.new-upload-btn:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

footer {
    background-color: #f8fafc;
    text-align: center;
    padding: 1.2rem;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Status Colors */
.status-success {
    color: var(--success);
}

.status-error {
    color: var(--error);
}

.status-warning {
    color: var(--warning);
}

.status-info {
    color: var(--primary);
}

/* Mobile First Responsive */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    .file-size-warning {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    main {
        padding: 1.2rem;
    }
    
    .upload-section h2 {
        font-size: 1.3rem;
    }
    
    .upload-section > p {
        font-size: 0.9rem;
    }
    
    .supported-formats {
        padding: 1rem;
        gap: 0.7rem;
    }
    
    .format-group {
        font-size: 0.8rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-area i {
        font-size: 2.5rem;
    }
    
    .upload-area p {
        font-size: 1.1rem;
    }
    
    .file-info {
        padding: 1rem;
        gap: 1rem;
    }
    
    .file-preview {
        width: 120px;
        height: 120px;
    }
    
    .file-details p {
        font-size: 0.85rem;
    }
    
    .upload-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
        max-width: 260px;
    }
    
    .result-section h2 {
        font-size: 1.3rem;
    }
    
    .uploaded-media {
        min-height: 200px;
        padding: 0.8rem;
    }
}

/* Tablet and Desktop */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }
    
    .container {
        max-width: 700px;
    }
    
    .url-box {
        flex-direction: row;
    }
    
    .url-box input {
        border-radius: var(--radius) 0 0 var(--radius);
        border-right: none;
    }
    
    .url-box button {
        border-radius: 0 var(--radius) var(--radius) 0;
        width: auto;
        min-width: 120px;
    }
    
    .file-info {
        flex-direction: row;
        text-align: left;
    }
    
    .file-details p {
        justify-content: flex-start;
    }
    
    .file-details strong {
        min-width: 100px;
        text-align: left;
    }
    
    .file-details span {
        text-align: left;
        margin-left: 0.5rem;
    }
    
    .result-container {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .uploaded-media {
        min-height: 250px;
    }
}

/* Large Desktop */
@media (min-width: 1024px) {
    .container {
        max-width: 900px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #f1f5f9;
        --text-light: #cbd5e1;
        --border: #475569;
        --secondary: #1e293b;
    }
    
    body {
        background: linear-gradient(135deg, #4c51bf 0%, #702459 100%);
    }
    
    .container {
        background: #0f172a;
    }
    
    .url-box input {
        background-color: #1e293b;
        color: var(--text);
        border-color: var(--border);
    }
    
    footer {
        background-color: #1e293b;
    }
    
    .file-details p {
        border-bottom-color: rgba(255,255,255,0.1);
    }
}

/* Prevent horizontal scroll and improve touch */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

button, .browse-btn, .upload-btn, .view-btn, .new-upload-btn {
    touch-action: manipulation;
}

/* Smooth transitions for all interactive elements */
.upload-area, .browse-btn, .upload-btn, .view-btn, .new-upload-btn, .url-box button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
