:root {
    --fujen-blue: #003366;
    --fujen-blue-rgb: 0, 51, 102; /* RGB values for --fujen-blue */
    --sp-red: #D8292F;
    --sp-red-rgb: 216, 41, 47; /* RGB values for --sp-red */
    --sp-orange: #F15A29; /* New color based on user image */
    --sp-yellow: #FFC72C;
    --sp-green: #00A99D;
    --sp-grey-light: #f1f1f1;
    --text-color: #333333;
    --white-color: #FFFFFF;
}

body {
    font-family: 'Open Sans', Helvetica, Arial, '微軟正黑體', 'Microsoft JhengHei', MingLiU, \5FAE\8EDF\6B63\9ED1\9AD4, 'Ubuntu Mono', '微软雅黑', Hei, sans-serif;
    color: var(--text-color);
}

/* --- Bootstrap Override --- */
.bg-light {
    background-color: var(--sp-grey-light) !important;
}
.btn-primary {
    background-color: var(--fujen-blue);
    border-color: var(--fujen-blue);
}
.btn-primary:hover {
    background-color: #b02127;
    border-color: #b02127;
    transform: scale(1.05);
}
.btn-outline-primary {
    color: var(--fujen-blue);
    border-color: var(--fujen-blue);
}
.btn-outline-primary:hover {
    color: var(--white-color);
    background-color: var(--fujen-blue);
    border-color: var(--fujen-blue);
}
.text-bg-dark {
    color: #fff !important;
    background-color: var(--text-color) !important;
}

/* --- Navigation --- */
.navbar-brand {
    color: var(--fujen-blue) !important;
}

.navbar-brand img {
    height: 40px;
}

.nav-link {
    font-weight: 500;
    color: #555;
    transition: color 0.3s;
}

.nav-link:hover, .dropdown-item:hover {
    color: var(--sp-red);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
}

/* --- Multi-level Dropdown --- */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -1px;
    margin-left: -1px;
    border-radius: 0 6px 6px 6px;
}

.dropdown-submenu:hover .dropdown-menu {
    display: block;
}

.dropdown-submenu > .dropdown-item::after {
    display: block;
    content: " ";
    float: right;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
    border-width: 5px 0 5px 5px;
    border-left-color: #ccc;
    margin-top: 5px;
    margin-right: -10px;
}

.dropdown-submenu:hover > .dropdown-item::after {
    border-left-color: var(--sp-red);
}

.dropdown-submenu .dropdown-item {
    padding-right: 30px;
}

/* Responsive adjustments for mobile */
@media (max-width: 991.98px) {
    .dropdown-submenu .dropdown-menu {
        position: static;
        float: none;
        width: auto;
        margin-top: 0;
        background-color: rgba(0,0,0,.125);
        border: 0;
        box-shadow: none;
    }
    
    .dropdown-submenu > .dropdown-item::after {
        display: none;
    }
    
    .dropdown-submenu .dropdown-item {
        padding-left: 2rem;
        padding-right: 1rem;
    }
}

/* --- Hero Video Section --- */
#hero-video {
    position: relative;
    height: 70vh; /* Increased height for better visual */
    min-height: 500px;
    width: 100%;
    color: var(--white-color);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.video-background-holder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.video-background-iframe-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    pointer-events: none; /* Allows clicks to go through to elements behind if any */
}

.video-background-iframe-wrapper iframe {
    width: 100vw;
    height: 56.25vw; /* 16:9 aspect ratio */
    min-width: 177.77vh; /* 16:9 aspect ratio */
    min-height: 100vh;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#hero-video .container {
    position: relative;
    /* z-index: 2; <-- This style is now inline in index.html */
}

.hero-content-overlay {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 2rem;
    border-radius: 0.5rem;
}

#hero-video .btn-primary {
    background-color: var(--sp-red);
    border-color: var(--sp-red);
    transition: background-color 0.3s, border-color 0.3s, transform 0.3s;
}

#hero-video .btn-primary:hover {
    background-color: #b02127;
    border-color: #b02127;
    transform: scale(1.05);
}

.hero-quick-links-box {
    position: absolute;
    bottom: -740px; /* Pull the box down to bleed out of the section */
    right: 0; /* 緊靠螢幕右側 */
    width: 30%;
    max-width: 400px;
    background-color: var(--fujen-blue);
    padding: 1.5rem;
    color: var(--white-color);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border-radius: 50px 0 0 0;
    border-color: #FFFFFF;
    border-top: solid #FFFFFF 10px;
    border-left: solid #FFFFFF 10px;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.quick-link-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white-color);
    padding: 0.75rem;
    text-align: center;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background-color 0.3s;
    font-weight: 500;
    font-size: 1.1rem;
}

.quick-link-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
    color: var(--white-color);
}

/* 媒體查詢 - 確保在小螢幕上有適當的顯示 */
@media (max-width: 992px) {
    .hero-quick-links-box {
        position: relative;
        right: auto;
        bottom: auto;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        margin-top: 2rem;
    }
}

.hero-red-box {
    /* This class is no longer in use in the HTML for the quick links, but keeping styles to avoid breaking other potential elements. It's superseded by .hero-quick-links-box */
    position: absolute;
    bottom: -60px; /* Pull the box down to bleed out of the section */
    right: 12px; /* Bootstrap container padding */
    width: 45%;
    background-color: var(--sp-orange);
    padding: 2rem;
    color: var(--white-color);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border-radius: 1rem; /* Added soft rounded corners */
}

.hero-red-box h2 {
    font-weight: 700;
}

.hero-red-box p {
    font-weight: 300;
}

.hero-red-box .btn-light {
    border-radius: 0;
    font-weight: bold;
    color: var(--sp-red);
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
}

.hero-red-box .btn-light:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
}

.hero-red-box .btn-light i {
    transition: transform 0.3s ease;
    display: inline-block;
}

.hero-red-box .btn-light:hover i {
    transform: translateX(5px);
}

/* --- Section Title --- */
.section-title {
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
    margin-bottom: 2rem;
    font-size: 1.6rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: var(--sp-red);
    border-radius: 2px;
}
.section-title span {
    font-weight: 700;
    color: var(--fujen-blue);
}

/* --- News Section --- */
#news {
    padding-top: 100px !important; /* Adjust padding to account for hero box overlap */
}
#news .nav-pills .nav-link {
    color: var(--text-color);
    border: 1px solid #ddd;
    margin: 0 5px;
    border-radius: 20px;
}

#news .nav-pills .nav-link.active {
    background-color: var(--fujen-blue);
    color: var(--white-color);
    border-color: var(--fujen-blue);
}

/* --- News Page Styles --- */
.news-card {
    transition: transform 0.3s, box-shadow 0.3s;
    border-left: 4px solid transparent;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.news-card .badge.bg-danger {
    border-left-color: var(--sp-red);
}

.news-card .badge.bg-primary {
    border-left-color: var(--fujen-blue);
}

.news-card .badge.bg-secondary {
    border-left-color: #6c757d;
}

.news-card .btn-outline-primary i,
.news-detail .btn-outline-primary i {
    transition: transform 0.3s;
}

.news-card .btn-outline-primary:hover i,
.news-detail .btn-outline-primary:hover i {
    transform: translateX(5px);
}

/* --- News Detail Page Styles --- */
.news-detail h1 {
    color: var(--fujen-blue);
}

.news-detail h2 {
    color: var(--fujen-blue);
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.news-detail .lead {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 1.5rem;
}

.news-content {
    line-height: 1.8;
}

.news-content a {
    color: var(--sp-red);
    text-decoration: none;
}

.news-content a:hover {
    text-decoration: underline;
}

.news-footer {
    margin-top: 2rem;
}

.breadcrumb a {
    color: var(--fujen-blue);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--sp-red);
    text-decoration: underline;
}

.bg-orange {
    background-color: var(--accent-color) !important;
}
.bg-primary {
    background-color: var(--primary-color) !important;
}

.badge.bg-danger {
    background-color: var(--sp-red) !important;
}
.badge.bg-primary {
    background-color: var(--fujen-blue) !important;
}
.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* --- Resource Cards --- */
.resource-card {
    border: 1px solid #e0e0e0;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}
.resource-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.1);
    border-color: var(--sp-red);
}

.resource-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-left: auto;
    margin-right: auto;
}

.resource-card .card-title {
    color: var(--fujen-blue);
    font-weight: bold;
}

/* --- About Us --- */
#about .btn-outline-primary {
    border-color: var(--sp-green);
    color: var(--sp-green);
}
#about .btn-outline-primary:hover {
    background-color: var(--sp-green);
    border-color: var(--sp-green);
    color: var(--white-color);
}

/* --- Freshmen Card --- */
.freshmen-card {
    overflow: hidden;
    transition: transform 0.3s;
}
.freshmen-card:hover {
     transform: scale(1.03);
}

.freshmen-card .card-img {
    object-fit: cover;
    height: 100%;
    filter: brightness(0.5) blur(2px);
    transition: filter 0.3s, transform 0.3s;
}
.freshmen-card:hover .card-img {
    filter: brightness(0.4) blur(0px);
    transform: scale(1.1);
}

.freshmen-card .card-img-overlay {
    background-color: rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s;
}
.freshmen-card:hover .card-img-overlay {
     background-color: rgba(0, 0, 0, 0.4);
}

.freshmen-card .btn-warning {
    background-color: var(--sp-yellow);
    border-color: var(--sp-yellow);
    color: var(--text-color);
    font-weight: bold;
    transition: transform 0.3s, background-color 0.3s;
}

.freshmen-card .btn-warning:hover {
    background-color: #ffda73;
    transform: scale(1.05);
}

/* --- High School Partnership List --- */
#partnership .list-group-item-action:hover {
    color: var(--sp-red);
    background-color: #f8f9fa;
}
#partnership .list-group-item-action:hover i {
    transform: translateX(5px);
}
#partnership i {
    transition: transform 0.2s ease-in-out;
}

/* --- Footer --- */
footer {
    background-color: var(--text-color);
}
.footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s;
}
.footer-link:hover {
    color: var(--sp-yellow);
}
.social-icon {
    color: var(--white-color);
    font-size: 1.5rem;
    margin-right: 15px;
    text-decoration: none;
    transition: color 0.3s;
}
.social-icon:hover {
    color: var(--sp-yellow);
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .nav-link {
        padding: 10px 0;
        width: 70px;
    }
    #hero-video {
        height: 60vh;
    }
    .hero-quick-links-box {
        width: 70%;
        bottom: -640px;
        right: 10px;
        padding: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    #hero-video {
        height: auto;
        padding-bottom: 2rem; /* Space for the box */
        min-height: unset;
    }
    .video-background-holder {
        position: relative;
        height: 0;
        padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
        overflow: visible; /* Allow box to be seen */
    }
    .video-background-iframe-wrapper,
    .video-background-iframe-wrapper iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        min-width: unset;
        min-height: unset;
        transform: none;
    }
     .video-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        /* The height is tricky, it should match the video's */
        padding-bottom: 56.25%; /* Match video aspect ratio */
        height: 0;
        background-color: rgba(0, 0, 0, 0.4);
        z-index: 1;
    }
    #hero-video .container {
        height: auto;
        padding-top: 0;
        padding-bottom: 0;
    }
    .hero-quick-links-box {
        position: relative;
        width: auto;
        bottom: auto;
        right: auto;
        left: auto;
        margin-left: 0px; /* Counteract container padding */
        margin-right: 0px;
        margin-top: 0rem;
        padding: 1.5rem;
        border-radius: 0;
        border: 0;
    }
     #news {
        padding-top: 2rem !important; /* Was 60px */
    }
}