* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #111 0%, #1c1c1c 100%);
    color: #f5f5f5;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    padding: 24px;
}

.container.small {
    max-width: 480px;
    padding-top: 50px;
    padding-bottom: 40px;
}

.admin-container {
    max-width: 1200px;
}

.card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
}

.login-card {
    text-align: center;
}

h1, h2, h3 {
    margin-top: 0;
    color: #ffffff;
}

h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

h2 {
    font-size: 1.4rem;
    margin-bottom: 16px;
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.sub {
    color: #d0d0d0;
    margin-bottom: 24px;
    line-height: 1.5;
}

form {
    display: grid;
    gap: 14px;
    text-align: left;
}

label {
    font-weight: bold;
    color: #f0f0f0;
}

input,
select {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #444;
    border-radius: 10px;
    font-size: 16px;
    background: #222;
    color: #fff;
}

input:focus,
select:focus {
    outline: none;
    border-color: #b22222;
    box-shadow: 0 0 0 3px rgba(178, 34, 34, 0.2);
}

button,
.button-link,
.logout {
    display: inline-block;
    text-decoration: none;
    background: #b22222;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s ease;
}

button:hover,
.button-link:hover,
.logout:hover {
    background: #8f1b1b;
    transform: translateY(-1px);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.alert {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #b94a48;
    background: rgba(185, 74, 72, 0.15);
    color: #ffd7d7;
    text-align: left;
}

video {
    width: 100%;
    border-radius: 12px;
    background: #000;
}

.logo {
    width: 110px;
    display: block;
    margin: 0 auto 18px auto;
}

.contact-image {
    text-align: center;
    margin-top: 30px;
}

.contact-image img {
    max-width: 360px;
    width: 90%;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Dashboard video cards */
.video-list {
    display: grid;
    gap: 18px;
}

.video-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.video-item p {
    color: #d5d5d5;
}

.video-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
}

.video-text {
    flex: 0 0 360px;
}

.video-belt {
    width: 150px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-shrink: 0;
}

.video-belt img {
    max-width: 140px;
    max-height: 90px;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
}

/* Admin forms */
.add-student-form,
.add-video-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.add-student-form .field,
.add-video-form .field {
    display: flex;
    flex-direction: column;
}

.add-student-form label,
.add-video-form label {
    font-size: 13px;
    margin-bottom: 4px;
}

.add-student-form input[name="full_name"] {
    width: 350px;
}

.add-student-form input[name="email"] {
    width: 480px;
}

.add-student-form select {
    width: 180px;
}

.add-student-form button {
    height: 44px;
    padding: 0 20px;
}

.add-video-form input[type="text"] {
    width: 220px;
}

.add-video-form select {
    width: 220px;
}

.add-video-form input[type="file"] {
    width: 260px;
}

/* Tables */
.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
    scrollbar-color: #b22222 #222;
}

.table-scroll-top {
    width: 100%;
    max-width: 100%;
    overflow-x: scroll;
    overflow-y: hidden;
    height: 18px;
    margin-bottom: 6px;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
    scrollbar-color: #b22222 #222;
}

.table-scroll-top > div {
    display: block;
    height: 1px;
    min-width: 1400px;
}

.admin-table {
    width: max-content;
    min-width: 1100px;
    border-collapse: collapse;
    table-layout: auto;
}

.admin-table th,
.admin-table td {
    padding: 6px 8px;
    vertical-align: middle;
    background-clip: padding-box;
    white-space: nowrap;
}

.admin-table th {
    color: #fff;
}

.admin-table tr {
    line-height: 1;
}

.admin-table input[type="email"] {
    width: 320px;
}

.admin-table input[type="text"] {
    width: 260px;
}

.admin-table select {
    width: 240px;
}

.admin-links p {
    margin: 12px 0;
}

.admin-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.admin-actions button {
    padding: 8px 12px;
    font-size: 14px;
}

/* Student search */
.student-search {
    margin-bottom: 18px;
}

.student-search input {
    width: 100%;
    max-width: 420px;
}

/* Replace file UI */
.replace-cell {
    width: 280px;
}

.replace-video-form {
    display: flex !important;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin: 0;
    text-align: left;
}

.replace-file-input {
    display: none !important;
}

.choose-file-btn {
    display: inline-block;
    background: #444;
    color: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    font-weight: normal;
}

.choose-file-btn:hover {
    background: #555;
}

.replace-file-name {
    display: inline-block;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    color: #ddd;
}

.replace-btn {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
    min-width: auto;
    flex-shrink: 0;
}

.table-wrap::-webkit-scrollbar,
.table-scroll-top::-webkit-scrollbar {
    height: 14px;
}

.table-wrap::-webkit-scrollbar-track,
.table-scroll-top::-webkit-scrollbar-track {
    background: #222;
    border-radius: 10px;
}

.table-wrap::-webkit-scrollbar-thumb,
.table-scroll-top::-webkit-scrollbar-thumb {
    background: #b22222;
    border-radius: 10px;
}

.table-wrap::-webkit-scrollbar-thumb:hover,
.table-scroll-top::-webkit-scrollbar-thumb:hover {
    background: #8f1b1b;
}

/* Sticky first column + sticky header */
.admin-table th:first-child,
.admin-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #1c1c1c;
}

.admin-table th:first-child {
    z-index: 5;
}

.admin-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #1c1c1c;
}

/* Responsive */
@media (max-width: 700px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    h1 {
        font-size: 1.7rem;
    }

    .card {
        padding: 18px;
    }

    .video-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .video-text {
        flex: none;
        width: 100%;
    }

    .video-belt {
        width: 100%;
        justify-content: flex-start;
    }

    .video-belt img {
        max-width: 140px;
        max-height: 90px;
    }
}