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

:root {
    --bg: #0e0e10;
    --bg-card: #18181b;
    --bg-hover: #222228;
    --text: #efeff1;
    --text-muted: #adadb8;
    --accent: #6d5bff;
    --accent-hover: #7c6cff;
    --border: #2a2a2e;
    --radius: 8px;
    --danger: #e04040;
    --danger-hover: #c03030;
    --success: #2ecc71;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
}

header h1 a {
    color: var(--text);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-badge {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Upload */
.upload-btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.upload-btn:hover {
    background: var(--accent-hover);
}

/* Gallery grid */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.clip-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s, transform 0.15s;
    border: 1px solid var(--border);
}

.clip-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

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

.clip-info {
    padding: 0.625rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.clip-name {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.clip-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.clip-uploader {
    padding: 0 0.75rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    color: var(--text-muted);
}

.pagination a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.pagination a:hover {
    text-decoration: underline;
}

/* Empty state */
.empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

/* Clip view */
.clip-view {
    max-width: 960px;
}

.clip-view video {
    width: 100%;
    border-radius: var(--radius);
    background: #000;
}

.clip-details {
    margin-top: 1rem;
}

.clip-details h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.clip-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
}

.clip-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
    background: var(--accent);
    color: #fff;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-approve {
    background: var(--success);
}

.btn-approve:hover {
    background: #27ae60;
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
    text-decoration: none;
}

.btn-link:hover {
    color: var(--text);
}

.btn-delete:hover {
    color: var(--danger);
}

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

/* Login page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.login-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}

.login-form h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-form .btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.625rem;
}

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

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.form-check {
    display: flex;
    align-items: center;
}

.form-check label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    cursor: pointer;
}

.form-error {
    background: rgba(224, 64, 64, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
}

.form-success {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
}

.form-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.form-footer a {
    color: var(--accent);
    text-decoration: none;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-approved {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
}

.status-pending {
    background: rgba(241, 196, 15, 0.15);
    color: #f1c40f;
}

/* Pending row highlight */
.row-pending {
    background: rgba(241, 196, 15, 0.04);
}

/* Notification badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    margin-left: 0.25rem;
}

/* Actions cell in tables */
.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Admin page */
.admin-page {
    max-width: 800px;
}

.admin-page h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.create-user-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.create-user-form h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 140px;
}

.form-row .form-check {
    padding-bottom: 0.5rem;
}

.form-row .btn {
    flex-shrink: 0;
}

/* Users table */
.users-table {
    overflow-x: auto;
}

.users-table table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.users-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.users-table tr:hover {
    background: var(--bg-card);
}

/* Comments */
.comments-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.comments-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.comment {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.375rem;
}

.comment-author {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-delete {
    margin-left: auto;
}

.comment-body {
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.15s;
}

.comment-form textarea:focus {
    border-color: var(--accent);
}

.comment-form .btn {
    align-self: flex-end;
}

/* Responsive */
@media (max-width: 640px) {
    header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .header-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    main {
        padding: 1rem;
    }
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .form-row {
        flex-direction: column;
    }
    .form-row .form-group {
        min-width: 100%;
    }
}
