:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --success: #10b981;
    --error: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #c084fc, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Navigation Tabs */
.tab-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

.tab-btn {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.8rem 2rem;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

.tab-content.active {
    display: block;
}

/* Upload Section */
.upload-section {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 2.5rem;
    /* margin-bottom: 4rem; */ /* Removed margin bottom as it is now controlled by tab content */
    box-shadow: var(--glass-shadow);
}

.file-drop-area {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 2.5rem;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(255,255,255,0.02);
    text-align: center;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.file-drop-area.drag-over {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

.default-content .icon-cloud {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    transition: color 0.3s;
}

.file-drop-area:hover .icon-cloud {
    color: var(--primary);
}

.file-msg {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.file-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-main);
}

.file-input {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    cursor: pointer;
    opacity: 0;
}

/* Preview Content */
.preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#videoPreview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
}

.remove-file-btn {
    background: none;
    border: none;
    color: var(--error);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.remove-file-btn:hover {
    transform: scale(1.1);
}

/* Form Controls */
.form-controls {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.title-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 0.8rem;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.title-input:focus {
    border-color: var(--primary);
}

.upload-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.8rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.5);
}

.upload-btn:disabled {
    cursor: not-allowed;
    filter: grayscale(0.5);
}

/* Progress Bar */
.progress-container {
    margin-top: 1.5rem;
    display: none;
}

.progress-container.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s ease;
}

.progress-text {
    text-align: right;
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
}

/* Filter Controls */
.filter-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

.date-input {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: 0.8rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.date-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.clear-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
}

.clear-filter-btn:hover {
    background: var(--error);
    color: white;
    border-color: transparent;
    transform: rotate(90deg);
}

.no-results {
    text-align: center;
    padding: 3rem;
    background: rgba(30, 41, 59, 0.3);
    border-radius: 1rem;
    border: 1px dashed var(--border);
    color: var(--text-muted);
    grid-column: 1 / -1;
    display: none;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding-bottom: 3rem;
}

.video-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out backwards;
}

.video-card.new-item {
    animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-color: var(--success);
}

.video-preview-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    position: relative;
}

.video-preview-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
}

.video-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
}

.download-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
    text-decoration: none;
    padding: 0.7rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.download-link:hover {
    background: var(--primary);
    color: white;
}

.delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.7rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem; /* Icon size */
}

.delete-btn:hover {
    background: var(--error);
    color: white;
    transform: scale(1.05);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.download-link {
    flex: 1; /* Take up remaining space */
}

/* Toasts */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateX(0);
}

.toast-success { border-left-color: var(--success); }
.toast-success ion-icon { color: var(--success); font-size: 1.5rem; }

.toast-error { border-left-color: var(--error); }
.toast-error ion-icon { color: var(--error); font-size: 1.5rem; }

/* Mobile */
@media (max-width: 600px) {
    .form-controls {
        flex-direction: column;
    }
    
    h1 { font-size: 2rem; }
    .upload-section { padding: 1.5rem; }
}

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

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

@keyframes bounceIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
