/* Critical CSS loaded inline in HTML */
/* Additional CSS loaded here */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --border-color: #e9ecef;
    --text-muted: #6c757d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-flex;
    margin-bottom: 15px;
}

.performance-indicator {
    display: flex;
    gap: 20px;
    justify-content: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success-color);
    animation: none;
}

/* CDN Validation Dashboard */
.validation-dashboard {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.validation-dashboard h3 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.validation-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    font-size: 0.9rem;
    opacity: 0.8;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.validation-summary {
    margin-bottom: 1.5rem;
}

.validation-summary h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.validation-progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.8s ease;
}

.validation-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.test-result {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.test-result.pass {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.test-result.fail {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.cdn-details {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.cdn-details p {
    margin: 0.5rem 0;
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.8;
}

.cdn-details strong {
    color: var(--text-color);
    opacity: 1;
}

.status-dot.error {
    background: var(--error-color);
    animation: none;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.performance-section, .stats-section {
    grid-column: 1 / -1;
}

.upload-section, .files-section, .performance-section, .stats-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-area {
    position: relative;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #f8f9ff, #ffffff);
}

.upload-area:hover {
    border-color: #667eea;
    background: linear-gradient(45deg, #f0f4ff, #f8f9ff);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #667eea;
    background: linear-gradient(45deg, #e6f2ff, #f0f4ff);
    transform: scale(1.02);
}

#fileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.upload-icon {
    font-size: 3rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.upload-text {
    font-size: 1.1rem;
    color: #666;
    font-weight: 500;
}

.upload-subtext {
    font-size: 0.9rem;
    color: #999;
    font-style: italic;
}

.upload-options {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-container input {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: linear-gradient(90deg, #e0e0e0, #f5f5f5);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    width: 0%;
    transition: width 0.3s ease;
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.search-container {
    flex: 1;
    max-width: 300px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.view-options {
    display: flex;
    gap: 10px;
}

.view-btn {
    padding: 8px 16px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.view-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-icon {
    font-size: 1.2rem;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    min-height: 200px;
}

.files-grid.list-view {
    grid-template-columns: 1fr;
}

.file-item {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.file-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.file-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.file-item:hover::before {
    transform: scaleX(1);
}

.file-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.file-name {
    font-weight: 600;
    margin-bottom: 8px;
    word-break: break-word;
    color: #333;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.file-date {
    color: #999;
    font-size: 0.8rem;
    margin-bottom: 20px;
}

.file-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-download, .btn-delete {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-download {
    background: var(--success-color);
    color: white;
}

.btn-delete {
    background: var(--error-color);
    color: white;
}

.btn-download:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.metrics-grid, .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.metric-card, .stat-card {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.metric-card:hover, .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.metric-card h3, .stat-card h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card span, .stat-card span {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-size: 1.1rem;
}

footer {
    text-align: center;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.footer-content p {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.notification.success {
    background: var(--success-color);
    color: white;
}

.notification.error {
    background: var(--error-color);
    color: white;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .files-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .metrics-grid, .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .files-grid {
        grid-template-columns: 1fr;
    }
    
    .upload-options {
        flex-direction: column;
        gap: 10px;
    }
}

/* Performance optimizations */
.file-item, .metric-card, .stat-card {
    will-change: transform;
}

.progress-fill {
    will-change: width;
}

/* CDN-specific optimizations */
img {
    loading: lazy;
    decoding: async;
}

/* File Preview Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90vw;
    height: 85vh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--light-bg);
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
}

.modal-controls {
    display: flex;
    gap: 10px;
}

.btn-close {
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: #c82333;
    transform: scale(1.1);
}

.modal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.preview-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #666;
}

.preview-error p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* File type specific previews */
.preview-video {
    width: 100%;
    height: 100%;
    background: #000;
}

.preview-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.preview-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.preview-pdf {
    width: 100%;
    height: 100%;
}

.preview-pdf iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.preview-text {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 20px;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
}

.preview-text pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.preview-audio {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.preview-audio audio {
    width: 80%;
    max-width: 600px;
    margin-top: 20px;
}

.audio-info {
    text-align: center;
    margin-bottom: 20px;
}

.audio-info h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.audio-info p {
    opacity: 0.8;
}

/* File actions with preview */
.btn-preview {
    background: var(--info-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-preview:hover {
    background: #138496;
    transform: translateY(-2px);
}

/* VLC Player Integration */
.preview-vlc {
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
}

.vlc-player-container {
    flex: 1;
    position: relative;
    background: #000;
}

.vlc-controls {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #333;
}

.vlc-audio-tracks {
    display: flex;
    gap: 10px;
    align-items: center;
}

.vlc-audio-tracks select {
    background: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 5px 10px;
}

.vlc-subtitle-tracks {
    display: flex;
    gap: 10px;
    align-items: center;
}

.vlc-subtitle-tracks select {
    background: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 5px 10px;
}

/* Advanced Video Options */
.preview-video-advanced {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.video-info h3 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: white;
}

.video-info p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.player-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin-bottom: 30px;
}

.btn-player {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    color: white;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-player:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-5px);
    color: white;
    text-decoration: none;
}

.btn-player small {
    opacity: 0.8;
    font-size: 0.9rem;
}

.btn-try {
    background: var(--warning-color);
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-try:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.file-info {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    text-align: left;
    max-width: 600px;
}

.file-info h4 {
    margin-bottom: 10px;
    color: #ffd700;
}

.file-info ul {
    list-style: none;
    padding: 0;
}

.file-info li {
    padding: 5px 0;
    padding-left: 20px;
    position: relative;
}

.file-info li:before {
    content: "✅";
    position: absolute;
    left: 0;
}

/* VLC Web Player Styles */
.vlc-web-player {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

.vlc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #000;
    color: white;
}

.vlc-loading .spinner {
    border-top-color: #ff6600;
}

.vlc-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #1a1a1a;
    color: white;
    text-align: center;
    padding: 40px;
}

.vlc-error h3 {
    color: #ff6600;
    margin-bottom: 20px;
}

.vlc-fallback-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.btn-vlc-fallback {
    background: #ff6600;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-vlc-fallback:hover {
    background: #e55a00;
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
} 