:root {
    --primary-color: #8B4513;
    /* SaddleBrown - a warm traditional tone */
    --secondary-color: #D2691E;
    /* Chocolate */
    --accent-color: #BF5940;
    /* Copied from original list.php text color */
    --bg-color: #f9f9f9;
    --card-bg: #ffffff;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --table-header-bg: #f0f0f0;
    --hover-bg: #fff8e1;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: #0066cc;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

/* Header Section */
.site-header {
    background-color: #fff;
    padding: 15px;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.logo-section img {
    max-width: 100%;
    height: auto;
    display: block;
}

.language-switch {
    display: flex;
    gap: 15px;
    font-size: 1rem;
    font-weight: bold;
}

.language-switch a {
    padding: 5px 10px;
    border-radius: 4px;
    background-color: #f0f0f0;
    color: #555;
}

.language-switch a:hover {
    background-color: var(--secondary-color);
    color: #fff;
}

.page-title {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin: 10px 0;
    font-weight: bold;
}

.intro-text {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--accent-color);
    font-size: 0.95rem;
    color: #555;
}

/* Search Form Section */
.search-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group select,
.form-group input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    background-color: #fff;
}

.form-group button,
.form-group input[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background 0.3s;
    height: 40px;
    /* match input height approx */
}

.form-group button:hover,
.form-group input[type="submit"]:hover {
    background-color: var(--secondary-color);
}

/* Data List Section */
.data-list {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* Desktop Table View */
.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-table th {
    background-color: var(--table-header-bg);
    color: var(--text-dark);
    padding: 12px;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    /* Prevent headers from wrapping */
}

.list-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    color: var(--text-dark);
}

/* Specific column adjustments for Desktop */
@media screen and (min-width: 769px) {

    .list-table th:nth-child(2),
    .list-table td:nth-child(2),
    .list-table th:nth-child(3),
    .list-table td:nth-child(3) {
        min-width: 110px;
        /* Ensure date columns are wide enough */
    }

    /* Video Name Column (Last column) */
    .list-table td:last-child {
        font-size: 1.2rem;
        /* Make video name larger */
        font-weight: 500;
    }

    /* Video Name Column - Target the link specifically */
    .list-table td.subject-title,
    .list-table td.subject-title a {
        font-size: 1.1rem;
        /* Make video name larger and explicit for links */
        font-weight: bold;
    }
}

.list-table tr:hover {
    background-color: var(--hover-bg);
}

.new-badge {
    display: inline-block;
    vertical-align: middle;
}

/* Mobile Card View */
@media screen and (max-width: 768px) {
    .logo-section {
        text-align: center;
        width: 100%;
        margin-bottom: 10px;
    }

    .language-switch {
        width: 100%;
        justify-content: center;
    }

    .list-table,
    .list-table thead,
    .list-table tbody,
    .list-table th,
    .list-table td,
    .list-table tr {
        display: block;
    }

    .list-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .list-table tr {
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--card-bg);
        padding: 10px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    }

    .list-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 35%;
        /* Space for label */
        padding-top: 10px;
        padding-bottom: 10px;
        text-align: right;
        /* Content aligns right */
    }

    .list-table td:last-child {
        border-bottom: none;
    }

    .list-table td:before {
        position: absolute;
        top: 10px;
        left: 10px;
        width: 30%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--text-light);
        content: attr(data-label);
    }

    /* Specific adjustments for title column on mobile to stand out */
    .list-table td[data-label="影音名稱"],
    .list-table td[data-label="影音名称"] {
        text-align: center;
        padding-left: 0;
        width: 100%;
        display: block;
        border-bottom: none;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .list-table td[data-label="影音名稱"]:before,
    .list-table td[data-label="影音名称"]:before {
        display: none;
    }

    /* Turn the link into a large button on mobile */
    .list-table td[data-label="影音名稱"] a,
    .list-table td[data-label="影音名称"] a {
        display: block;
        width: 100%;
        background-color: #cd853f;
        /* Peru - Lighter brown/orange */
        color: #ffffff;
        padding: 15px 10px;
        border-radius: 8px;
        font-size: 1.3rem;
        font-weight: bold;
        text-align: center;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        transition: transform 0.1s, background-color 0.2s;
    }

    .list-table td[data-label="影音名稱"] a:active,
    .list-table td[data-label="影音名称"] a:active {
        transform: scale(0.98);
        background-color: var(--secondary-color);
    }
}

/* Pagination */
.pagination {
    margin: 20px 0;
    text-align: center;
    font-size: 1.2rem;
    /* Base font size increased */
}

/* Target internal elements of the navigator */
.pagination table,
.pagination td,
.pagination div {
    font-size: 1.2rem !important;
}

.pagination a {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.pagination a:hover {
    background: var(--hover-bg);
}

.pagination input,
.pagination select {
    font-size: 1.1rem;
    padding: 4px;
    height: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.footer-links img {
    height: 35px;
    width: auto;
}

/* Detail View (show.php / view.php) Styles */
.view-container {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

    /* Centering and Width Logic */
    width: 95%;
    /* Take up most of the screen on mobile */
    max-width: 900px;
    /* Cap width on desktop */
    margin: 20px auto;
    /* Center horizontally */

    box-sizing: border-box;
    /* Ensure padding doesn't affect width */
}

.view-image {
    text-align: center;
    margin-bottom: 20px;
}

.view-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.view-subject {
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.view-meta {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 1rem;
}

.view-intro {
    background-color: var(--hover-bg);
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid var(--accent-color);
    margin-bottom: 20px;
    color: #555;
    line-height: 1.6;
}

.view-subtitle {
    font-size: 1.4rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.section-block {
    margin-bottom: 30px;
}

.section-header {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 15px;
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
}

.links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.link-item {
    flex: 0 0 auto;
}

.link-item a {
    display: inline-block;
    padding: 8px 15px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: #0066cc;
    text-align: center;
    min-width: 60px;
    transition: all 0.2s;
}

.link-item a:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    text-decoration: none;
}

@media screen and (max-width: 600px) {
    .view-subject {
        font-size: 1.5rem;
    }

    .links-grid {
        gap: 8px;
    }

    .link-item a {
        padding: 6px 12px;
        font-size: 0.95rem;
    }
}

/* Custom Navigation Buttons (Prev/Next 20) */
.custom-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.btn-nav {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: #fff !important;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
}

.btn-nav:hover {
    background-color: var(--secondary-color);
    color: #fff;
}