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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Navigation */
.navbar {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    color: #d32f2f;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: #d32f2f;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #66bb6a;
}

.alert-warning {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffb74d;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: #d32f2f;
    margin-bottom: 0.5rem;
}

.login-box h2 {
    margin-bottom: 1.5rem;
    color: #666;
}

.login-note {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #666;
    text-align: center;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.inline-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.inline-form input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s;
}

.btn-primary {
    background: #d32f2f;
    color: white;
}

.btn-primary:hover {
    background: #b71c1c;
}

.btn-secondary {
    background: #757575;
    color: white;
}

.btn-secondary:hover {
    background: #616161;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

/* Dashboard */
.dashboard h1 {
    margin-bottom: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    color: #666;
    font-size: 0.875rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #d32f2f;
}

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

.video-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.video-card img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.video-info {
    padding: 1rem;
}

.video-info h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-info .channel {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.video-info .meta {
    font-size: 0.875rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.video-info .date {
    font-size: 0.75rem;
    color: #999;
}

/* Video List */
.video-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.video-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.video-item img {
    width: 200px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 4px;
}

.video-details {
    flex: 1;
}

.video-details h3 {
    margin-bottom: 0.5rem;
}

.video-details h3 a {
    color: #333;
    text-decoration: none;
}

.video-details h3 a:hover {
    color: #d32f2f;
}

.video-details .channel {
    color: #666;
    margin-bottom: 0.5rem;
}

.video-details .meta,
.video-details .dates {
    font-size: 0.875rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.video-actions {
    display: flex;
    align-items: center;
}

/* Filters */
.filter-form {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filter-form input,
.filter-form select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.results-count {
    margin-bottom: 1rem;
    color: #666;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.page-link {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}

.page-link:hover {
    background: #f5f5f5;
}

.page-link.active {
    background: #d32f2f;
    color: white;
    border-color: #d32f2f;
}

/* Tokens */
.tokens-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tokens-table th,
.tokens-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.tokens-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.tokens-table tbody tr:hover {
    background: #fafafa;
}

.token-display {
    display: inline-block;
    background: #f5f5f5;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: monospace;
    margin: 0.5rem 0;
    word-break: break-all;
}

.status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status.active {
    background: #e8f5e9;
    color: #2e7d32;
}

.status.inactive {
    background: #ffebee;
    color: #c62828;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-state p {
    margin-bottom: 1rem;
    color: #666;
}

/* Video Detail Page */
.video-detail-page {
    max-width: 900px;
    margin: 0 auto;
}

.video-header {
    margin-bottom: 1.5rem;
}

.video-detail-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.video-detail-main {
    display: flex;
    gap: 1.5rem;
}

.video-detail-main img {
    width: 200px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.video-detail-info {
    flex: 1;
}

.video-detail-info h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.video-detail-info h1 a {
    color: #333;
    text-decoration: none;
}

.video-detail-info h1 a:hover {
    color: #d32f2f;
}

.video-detail-info .channel {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.video-detail-info .meta,
.video-detail-info .dates {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.5rem;
}

/* Description Section */
.description-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.description-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.description-section h2 {
    margin: 0;
    font-size: 1.25rem;
}

.toggle-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: #666;
    transition: background 0.2s;
}

.toggle-btn:hover {
    background: #e0e0e0;
}

.description-container {
    color: #666;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    transition: max-height 0.3s ease;
}

.description-container.collapsed {
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.description-container.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(transparent, white);
}

/* Summary Section */
.summary-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.summary-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.summary-section h2 {
    margin: 0;
    font-size: 1.25rem;
}

.summary-container {
    color: #333;
    line-height: 1.7;
    padding: 1rem;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: max-height 0.3s ease;
}

.summary-container.collapsed {
    max-height: 150px;
    overflow: hidden;
    position: relative;
}

.summary-container.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(transparent, #f9f9f9);
}

.summary-container .timestamp-link {
    color: #1976d2;
    font-family: monospace;
    font-size: 0.9rem;
    text-decoration: none;
    background: #e3f2fd;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    transition: background 0.2s;
}

.summary-container .timestamp-link:hover {
    background: #bbdefb;
    text-decoration: none;
}

.summary-container .external-link {
    color: #d32f2f;
    word-break: break-all;
}

.summary-container .external-link:hover {
    text-decoration: underline;
}

.summary-container h4 {
    margin: 1rem 0 0.5rem 0;
    font-size: 1.1rem;
    color: #333;
}

.summary-container h5 {
    margin: 0.75rem 0 0.5rem 0;
    font-size: 1rem;
    color: #444;
}

.summary-container ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.summary-container li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.summary-container strong {
    color: #222;
}

.summary-empty {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.summary-empty .note {
    font-size: 0.875rem;
    color: #999;
    margin-top: 0.5rem;
}

/* Transcript Section */
.transcript-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.transcript-section h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.transcript-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.transcript-container .transcript-line {
    margin-bottom: 0.75rem;
}

.transcript-container .timestamp {
    color: #888;
    font-family: monospace;
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

.transcript-empty {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.transcript-empty .note {
    font-size: 0.875rem;
    color: #999;
    margin-top: 0.5rem;
}

.video-actions-bottom {
    margin-top: 1.5rem;
}

/* Form Container */
.form-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 500px;
}

.form-container small {
    display: block;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.875rem;
}

.form-container small a {
    color: #d32f2f;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .video-item {
        flex-direction: column;
    }

    .video-item img {
        width: 100%;
    }

    .filter-form {
        grid-template-columns: 1fr;
    }

    .video-detail-main {
        flex-direction: column;
    }

    .video-detail-main img {
        width: 100%;
    }
}
