:root {
    --bg-white: #ffffff;
    --text-dark: #222222;
    --text-muted: #555555;
    --accent-blue: #00265c;
    --border-gray: #e0e0e0;
    --font-sans: 'Helvetica Neue', Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    overflow-wrap: break-word;
    hyphens: auto;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    color: var(--text-dark);
    background: var(--bg-white);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 12px; /* horizontal padding to avoid touching edges */
    gap: 12px;
}

/* Header and top link */
.returntop {
    width: 70%;
    text-align: center;
}

header, footer {
    text-align: center;
    width: 100%;
    max-width: 1100px;
    padding: 0 12px;
}

h1 {
    font-size: 2rem;
    color: var(--accent-blue);
    margin-bottom: 4px;
}

h2 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

hr {
    margin: 10px auto;
    border: none;
    height: 2px;
    background: var(--accent-blue);
    width: 69%; /* Nice ;) */
}

a, .current {
    display: inline-block;
    text-decoration: none;
    color: var(--bg-white);
    background-color: var(--accent-blue);
    padding: 12px 25px;
    margin: 5px 0;
    border-radius: 5px;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.prev, .next {
    display: inline-block;
    text-decoration: none;
    color: var(--bg-white);
    background-color: var(--accent-blue);
    padding: 12px 25px;
    margin: 5px 0;
    border-radius: 5px;
    transition: background-color 0.3s, box-shadow 0.3s;
}

a:hover {
    background-color: #003a8c;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.dropdown {
position: relative;
display: inline-block;
font-family: sans-serif;
}
.dropdown-toggle {
display: inline-block;
padding: 8px 12px;
background:#f1f1f1;
border:1px solid #ccc;
cursor:pointer;
user-select:none;
}

#open-toggle {
    display:none;
}

.panel {
position:absolute;
left:0;
top:100%;
margin-top:4px;
border:1px solid #ddd;
background:#fff;
box-shadow:0 2px 6px rgba(0,0,0,0.1);
max-height:250px;
overflow:auto;
display:none;
min-width:200px;
padding:8px;
z-index:10;
text-align: left;
}


#open-toggle:checked + label + .panel { 
    display:block; 

}

.panel label { 
    display:block;
    padding:4px 6px;
    cursor:pointer;
}

.panel input[type="checkbox"] { 
    margin-right:6px; 
}

button[type="submit"] { margin-top:10px; padding:6px 12px; }

label {
    display: block;
    margin: 10px 0 5px;
    color: #000000;
}

input[type="text"],
textarea,
input[type="date"],
input[type="file"] {
    width: 80%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus,
input[type="file"]:focus {
    outline: none;
    border-color: #00265c; /* Focus color */
}

/* Main video list container */
.videos {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    padding: 0 12px;
    overflow: visible;
}

/* Individual video block */
.video-block{
    display: flex;
    width: 70%;
    background: var(--bg-white);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    align-items: stretch;
}

/* Desktop/tablet layout: media left, info right */
.video-block video {
    flex: 0 0 40%;
    max-width: 40%;
    height: auto;
    background: #000;
    display: block;
}

/* Info column */
.video-block .info {
    flex: 1 1 0;
    padding: 15px;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0; /* Important to allow text truncation/line-wrap instead of overflow */
    gap: 8px;
}

.video-block .info h2 {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 0;
    position: relative;
    word-break: break-word;
}

.video-block .info h2::after {
    content: "";
    display: block;
    height: 2px;
    background: var(--accent-blue);
    margin-top: 4px;
}

.video-block .info .date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.video-block .info .description {
    font-size: 0.95rem;
    color: var(--text-muted);
    padding: 8px;
    border: 1px solid var(--accent-blue);
    border-radius: 4px;
    overflow: auto; /* allow scroll if description is long */
    max-height: 350px; /* prevents very long descriptions from expanding page unexpectedly */
}

/* Forms and login */
.login {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
}

.login-form {
    max-width: 400px;
    margin: auto;
}

.download {
    text-align: center;
}

/* Pagination */
.pagination {
    width: 100%;
    max-width: 1100px;
    padding: 10px 12px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.active {
    font-weight: bold;
    color: #2877e6;  /* Highlight active page in red */
}

/* Small screens: stack vertically, ensure no overlap */
@media (max-width: 900px) {
    .video-block {
        flex-direction: column;
    }
    .video-block video {
        width: 100%;
        max-width: 100%;
        flex: 0 0 auto;
        height: auto;
    }
    .video-block .info {
        padding: 12px;
    }
    .video-block .info .description {
        max-height: none; /* allow full description height on narrow screens */
        overflow: visible;
    }
}

/* Very small screens: extra spacing to avoid overlap and ensure readable text */
@media (max-width: 420px) {
    body {
        padding: 16px 10px;
    }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 0.95rem; }
    .video-block { border-radius: 6px; }
    .video-block .info { padding: 10px; }
    .video-block .info h2 { font-size: 1rem; }
}

/* Accessibility: focus outlines */
a:focus, button:focus, .download:focus {
    outline: 3px solid rgba(0, 38, 92, 0.2);
    outline-offset: 2px;
}