/* ------------------ VARIABLES ------------------ */
:root {
    --accent: #2ec4b6;
    --dark: #2f3542;
    --bg: #f5f6f8;
}

/* ------------------ RESET ------------------ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, sans-serif;
}

body {
    background: var(--bg);
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ------------------ HEADER ------------------ */
.header {
    padding: 32px 20px;
    text-align: center;
}

.logo {
    font-size: 56px;
    font-weight: 600;
    margin-bottom: 16px;
}

.logo-small {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 16px;
}


.logo span {
    color: var(--accent);
}

.logo-small span {
    color: var(--accent);
}


#search {
    width: 100%;
    max-width: 360px;
    padding: 10px 14px;
    font-size: 15px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

#search:focus {
    outline: none;
    border-color: var(--accent);
}

/* ------------------ CLICKY LINK ------------------ */
.info-toggle-container {
    text-align: center;
    margin: 12px 0;
}

.info-toggle {
    display: none;
    font-weight: bold;
    cursor: pointer;
    color: var(--accent);
    text-decoration: underline;
}

/* ------------------ LAYOUT ------------------ */
.layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* ------------------ TABLE ------------------ */
.table-wrapper {
    flex: 1;
    transition: flex 0.25s ease, transform 0.25s ease;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: var(--dark);
    color: #fff;
    border-bottom: 3px solid var(--accent);
}

th, td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
}

th.sort-asc::after { content: " ▲"; font-size: 0.7em; }
th.sort-desc::after { content: " ▼"; font-size: 0.7em; }

tbody tr:nth-child(odd) { background: #f8f9fb; }
tbody tr:nth-child(even) { background: #eef1f6; }
tbody tr:hover { background: #e3e7ee; }
tbody tr.active { background: rgba(46,196,182,0.18)!important; }

/* ------------------ INFO BOX ------------------ */
.info-box {
    position: relative;
    flex: 0 0 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateX(10px);
    transition: max-width 0.25s ease, opacity 0.2s ease, transform 0.2s ease;
    border: 1px solid #ccc;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    text-align: center;
}

.info-box.visible {
    flex: 1.5;
    max-width: 420px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.info-box .poster {
    width: 120px;
    border-radius: 6px;
    background: #e0e0e0;
    display: none;

    /* Center horizontally */
    margin: 0 auto;
    display: block; /* ensures the centering works */
}

.info-text h3 { font-size: 18px; margin-bottom: 6px; }

.info-text p, .info-text #infoDetails, .info-text #infoExtra { text-align: center; }

.overlay-close {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
}

/* ------------------ PAGINATION ------------------ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.pagination button {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
}

.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ------------------ FOOTER ------------------ */
.footer {
    margin-top: auto;
    border-top: 1px solid #ddd;
    background: #fff;
}

.footer-inner { max-width: 1200px; margin: 0 auto; padding: 16px 20px 24px; }

.footer-content { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 12px; }

.footer button {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
}

/* ------------------ FORM ------------------ */
.footer-form {
    max-width: 600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.footer-form.visible { max-height: 700px; }

.footer-form input,
.footer-form textarea {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.footer-form input[name="imdb"],
.footer-form textarea { grid-column: 1 / -1; }
.footer-form input[name="season"],
.footer-form input[name="episode"] { max-width: 120px; }
.footer-form textarea { min-height: 120px; resize: vertical; line-height: 1.4; }
.footer-form button { grid-column: 2; justify-self: end; background: var(--accent); color: #fff; border: none; padding: 8px 18px; }

.form-success, .form-fail {
    max-width: 600px;
    margin: 10px auto 0;
    font-size: 14px;
    display: none;
}

.form-success { color: var(--accent); }
.form-fail { color: red; }

/* ------------------ IMDb ------------------ */
.imdb-link img { width: 40px; cursor: pointer; transition: transform 0.15s ease, opacity 0.15s ease; }
.imdb-link:hover img { transform: scale(1.05); opacity: 0.9; }


#infoImdb {
    display: none; /* hide link + image initially */
}

/* ------------------ MOBILE ------------------ */
@media (max-width: 700px) {
    .layout { flex-direction: column; }
    .poster { width: 90px; }
}

@media (max-width: 600px) {
    .footer-form { grid-template-columns: 1fr; }
    .footer-form button { grid-column: 1; justify-self: stretch; }
}

.hover-box {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 12px 16px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    z-index: 9999;
    pointer-events: none; /* only for hover, will toggle on */
    font-size: 14px;
    line-height: 1.4;
}

.hover-box.visible {
    display: block;
    pointer-events: auto;
}

.hover-box h4 {
    margin: 0 0 6px;
    font-size: 16px;
}

.hover-box button#hoverClose {
    position: absolute;
    top: 4px;
    right: 6px;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
}
