:root {
    --primary-color: #ef4444; /* Classic Red */
    --primary-hover: #dc2626;
    --bg-main: #111827; /* Dark Gray / Near Black */
    --bg-card: #1f2937; /* Slightly lighter gray for panels */
    --border-color: #374151; /* Subtle border */
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --terminal-bg: #030712;
    --terminal-text: #10b981; /* Classic green terminal text */
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
}

/* Main Container */
.container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

header h1 span {
    color: var(--primary-color);
}

header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 400;
}

/* Classic Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px; /* Classic slight rounding */
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

label {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-main);
}

textarea {
    background-color: #111827;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2); /* Classic focus ring */
}

textarea::placeholder {
    color: #6b7280;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider span {
    padding: 0 1rem;
}

/* File Upload - Classic style */
.file-drop-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: rgba(17, 24, 39, 0.5);
}

.file-drop-area:hover, .file-drop-area.highlight {
    border-color: var(--primary-color);
    background-color: rgba(239, 68, 68, 0.05);
}

.file-drop-area.has-file {
    border-color: var(--primary-color);
    border-style: solid;
    background-color: rgba(239, 68, 68, 0.1);
}

.file-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.file-msg {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
}

input[type="file"] {
    display: none;
}

/* Classic Button */
.btn-glow { /* Kept class name for JS compatibility but removed glow styling */
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: white;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-glow:hover {
    background-color: var(--primary-hover);
}

.btn-glow:active {
    transform: scale(0.98);
}

.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

.btn-glow.loading .btn-text {
    display: none;
}

.btn-glow.loading .spinner {
    display: block;
}

.btn-glow.loading {
    cursor: not-allowed;
    opacity: 0.8;
}

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

/* Terminal Panel */
.terminal-panel {
    background-color: var(--terminal-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background-color: #1f2937;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.close { background-color: #ef4444; }
.minimize { background-color: #f59e0b; }
.maximize { background-color: #10b981; }

.terminal-title {
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

#terminalOutput {
    padding: 1.5rem;
    margin: 0;
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: var(--terminal-text);
    line-height: 1.5;
    height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Custom Scrollbar */
#terminalOutput::-webkit-scrollbar {
    width: 8px;
}

#terminalOutput::-webkit-scrollbar-track {
    background-color: var(--terminal-bg);
}

#terminalOutput::-webkit-scrollbar-thumb {
    background-color: #374151;
    border-radius: 4px;
}

#terminalOutput::-webkit-scrollbar-thumb:hover {
    background-color: #4b5563;
}

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
    }
}

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

.video-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.video-thumb {
    width: 100%;
    height: 160px;
    background-color: #000;
    border-radius: 6px;
    margin-bottom: 1rem;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.video-card:hover .video-thumb img {
    transform: scale(1.05);
}

.fallback-icon {
    font-size: 3rem;
    color: var(--primary-color);
    background: rgba(239, 68, 68, 0.1);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    z-index: 2;
    pointer-events: none;
    backdrop-filter: blur(2px);
}

.quality-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background-color: var(--primary-color);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.delete-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(239, 68, 68, 0.9); /* Rot */
    color: white;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.delete-badge:hover {
    background-color: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.edit-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(59, 130, 246, 0.9); /* Blau */
    color: white;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.edit-badge:hover {
    background-color: rgba(37, 99, 235, 1);
    transform: scale(1.1);
}

.video-info {
    width: 100%;
}

.video-info h3 {
    font-size: 0.95rem;
    line-height: 1.4;
    height: 2.66rem; /* Exakt 2 Zeilen (0.95rem * 1.4 * 2) */
    color: var(--text-main);
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
}

.video-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.page-link {
    background-color: var(--bg-main);
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s;
    font-weight: 500;
}

.page-link:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--primary-color);
}

.page-info {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-card);
    width: 90%;
    max-width: 1000px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #111827;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1rem;
}

.close-modal {
    color: var(--text-muted);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: #ef4444;
    text-decoration: none;
}

.modal-body {
    padding: 0;
    background-color: #000;
    display: flex;
    justify-content: center;
}

#player {
    width: 100%;
    max-height: 70vh;
    outline: none;
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}
