/* 全局樣式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f0f4f7;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
}

.container {
    width: 80%;
    max-width: 1000px;
    margin: 30px auto;
    background: linear-gradient(191deg, rgba(0, 149, 217, 1) 0%, rgba(248, 248, 248, 1) 150px);
    padding: 25px 12px;
    border-radius: 10px;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #007bff;
    text-align: center;
    font-size: 32px;
    margin-bottom: 20px;
}

h2 {
    color: #333;
    text-align: center;
    font-size: 24px;
    margin-bottom: 15px;
}

a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}

a:hover {
    text-decoration: underline;
}

.user-group {
    color: #fff;
}

.user-info {
    display: flex;
    align-items: center;
    /* 文字與頭像水平對齊 */
}

.user-avatar {
    width: 40px;
    /* 調整頭像大小 */
    height: 40px;
    /* 調整頭像大小 */
    border-radius: 50%;
    /* 圓形效果 */
    margin-right: 10px;
    /* 調整頭像與文字間距 */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    /* 添加灰影 */
    border: 2px solid white;
}

/* 功能菜單 樣式 */
.placeholder {
    background-color: #019846;
    border-radius: 0 0 7px 7px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9;
}

.placeholder-top,
.placeholder-bottom {
    display: block;
    height: 45px;
}

.user-welcome {
    width: 100%;
    background-color: beige;
}

.welcome-text {
    min-height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.user-desc {
    display: flex;
    flex-direction: column;
}

.user-d-c {
    color: #ccccd8;
    font-size: 12px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    width: 100%;
    /* 使 navbar 填滿水平空間 */
    box-sizing: border-box;
    /* 讓 padding 與 width 合併計算 */
}

.navbar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

.nav-item {
    margin-right: 10px;
}

.nav-link {
    text-decoration: none;
    color: #333;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.nav-link:hover {
    background-color: #ccc;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown button {
    border: none;
    background-color: transparent;
    /* 刪除 SVG 圖標的背景色 */
}

.dropdown-content {
    position: absolute;
    background-color: #f9f9f9;
    min-width: 140px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1;
    right: 0;
    /* 將彈出框固定在右側 */
    opacity: 0;
    /* 初始透明度為 0 */
    max-height: 0;
    /* 初始高度為 0 */
    overflow: hidden;
    /* 隱藏溢出內容 */
    transition: max-height 0.3s ease, opacity 0.3s ease;
    /* 添加過渡效果 */
}

.dropdown:hover .dropdown-content {
    max-height: 450px;
    /* 鼠標懸停時設置最大高度，通過過渡效果逐漸增加到實際內容的高度，從而實現了下拉菜單展開的動畫效果。 */
    opacity: 1;
    /* 設置透明度為 1 */
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.payvip-btn {
    background: linear-gradient(300deg, #4c4d51, #2a2a31 15%, #85858a 40%, #393a3c 60%, #393838 80%, #5e5f62 100%);
    text-shadow: none;
    font-weight: 400;
    position: relative;
    border: none;
    overflow: hidden;
    cursor: pointer;
}

/* 功能菜單 樣式 end */

/* 麵包屑導航 */
.breadcrumb {
    display: inline-block;
    width: 100%;
    position: relative;
    /* 讓偽元素相對於 .breadcrumb 定位 */
}

.breadcrumb::before {
    content: '';
    /* 設置偽元素的內容為空 */
    position: absolute;
    /* 絕對定位偽元素 */
    top: 0;
    /* 與容器頂部對齊 */
    left: 0;
    /* 與容器左邊對齊 */
    width: 100%;
    /* 使偽元素寬度與容器相同 */
    height: 1px;
    /* 邊框高度 */
    border-bottom: 1px dashed #ccc;
    /* 使用虛線作为邊框 */
}

.breadcrumb-inner {
    color: #fff;
    margin: 0.4rem 1rem 0.4rem 1rem;
}

.breadcrumb a {
    color: #d0ff81;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: #0056b3;
}

.breadcrumb .separator {
    margin: 0 5px;
    color: #666;
}

.breadcrumb .current-page {
    color: #333;
    font-weight: bold;
}

/* 麵包屑導航 end */

/* 表單樣式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

/* 確保所有表單輸入框大小一致 */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
    box-sizing: border-box; /* 確保寬度包含 padding 和邊框 */
    transition: all 0.3s ease;
}

/* 將其他輸入框樣式統一 */
.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="date"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #007bff;
    background-color: #fff;
}

.form-group input[type="submit"] {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    font-size: 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.form-group input[type="submit"]:hover {
    background-color: #0056b3;
}

/* 單選按鈕樣式 */
.form-group div input[type="radio"] {
    margin-right: 10px;
}

.privacy h2 {
    text-align: left;
}

.license-plate-number {
    /* 這裡的原有樣式會被 .result-block .license-plate-number 覆蓋，
       但保留此處的全局定義，以防其他地方使用。 */
    font-size: 28pt !important; 
}

.loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 16px;
}

/* ------------------------------------------------ */
/* 🚀 修正點 1: 查詢結果結構化 (用於 index.php 的 .result) */
/* ------------------------------------------------ */

/* 基礎區塊樣式 */
.result-block {
    margin-bottom: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    background-color: #ffffff; /* 使用白色背景突出 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* 輕微陰影，增加立體感 */
}

/* 確保區塊內的 p 標籤間距正常 (取代舊的 .result p) */
.result-block p {
    margin: 5px 0;
    line-height: 1.5;
    font-size: 16px;
    border: none; /* 移除舊的邊框 */
    padding: 0;
    background-color: transparent;
}

/* 車牌號碼區域樣式 */
.license-plate-area {
    background-color: #f0f4f7; /* 淺灰色背景 */
    text-align: center;
    border: 1px solid #ccc;
    font-size: 18px; /* 增加標籤字體大小 */
}

/* 覆蓋 .license-plate-number 的全局樣式，讓它在結果區塊中放大 */
.license-plate-area .license-plate-number {
    font-size: 32px !important; /* 放大車牌號碼 */
    color: #007bff; /* 突出顏色 */
    display: block; /* 讓它獨佔一行 */
    margin-top: 5px;
    font-weight: bolder;
}

/* 媒體列表 (相片/影片) 容器 */
.media-list {
    display: flex; /* 讓圖片/影片橫向排列 */
    flex-wrap: wrap; /* 允許換行 */
    gap: 10px; /* 圖片間距 */
    margin-top: 10px;
}

/* ------------------------------------------------ */
/* 🚀 修正點 2: 查詢結果媒體放大 (取代舊的 .result img / .result video) */
/* ------------------------------------------------ */

/* 媒體單元 (圖片和影片) 的尺寸控制 */
.media-list .media-item,
.result img,
.result video { 
    width: 100%; /* 預設佔滿寬度 */
    max-width: 280px; /* 限制單個媒體項目的最大寬度 */
    height: auto;
    border-radius: 5px;
    object-fit: cover;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    /* 確保直接放置在 .result 中的 img/video 也能被控制 */
    display: block; 
    margin: 0; /* 移除舊的 margin-top */
}

/* 🚀 修正點：單獨針對影片設置 max-width 為 100% */
.media-list video.media-item,
.result video {
    max-width: 100%; /* 影片寬度最大佔滿父容器 */
    object-fit: contain; /* 影片通常使用 contain 保持內容完整性 */
}

/* 移除舊的結果樣式，避免衝突 */
.result p { /* 這是原本的 .result p，但已被新的 .result-block p 覆蓋多數功能 */
    /* 為了不破壞原有結構，將其保留，但移除會影響結構的樣式 */
    margin: 15px 0;
    line-height: 1.5;
    border: none; /* 移除邊框 */
    padding: 0; /* 移除 padding */
    background-color: transparent; /* 移除背景色 */
}

/* ------------------------------------------------ */
/* 首頁的導航樣式 */
nav a {
    margin: 0 15px;
    font-size: 18px;
}

.disabled-link {
    pointer-events: none; /* 禁用點擊 */
    color: gray; /* 改變字體顏色以顯示為禁用狀態 */
    text-decoration: none; /* 移除底線 */
    cursor: not-allowed; /* 改變滑鼠游標 */
    opacity: 0.6; /* 增加透明度以顯示禁用效果 */
}

.disabled-link:hover {
    text-decoration: none; /* 防止懸停時顯示底線 */
}

/* ------------------------------------------------ */
/* 🚀 修正點 3: 放大圖片樣式 (Modal) - 保留並優化過渡 */
/* ------------------------------------------------ */
.modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* 調整為更深，突出內容 */
    align-items: center;
    justify-content: center;
    /* 新增：為彈出效果添加過渡 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 顯示時的樣式 */
.modal.is-visible {
    opacity: 1;
    visibility: visible;
}

/* 內容容器 (包裹 img 和 video，確保它們不會超出螢幕) */
.modal-content-wrapper { 
    position: relative;
    max-width: 90%; /* 讓內容更寬 */
    max-height: 90%;
    /* 新增：內容從中心稍微放大彈出 */
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.modal.is-visible .modal-content-wrapper {
    transform: scale(1);
}

/* 媒體元素 (圖片和影片) 的通用樣式 */
.media-element {
    width: auto; 
    height: auto; 
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px; /* 圓角效果 */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5); /* 增加陰影深度 */
    object-fit: contain; 
}

/* 移除原有的 .modal img 樣式，使用 .media-element 統一管理 */
.modal img {
    /* 保留原有的基礎樣式，但讓 .media-element 負責尺寸 */
    width: 100%;
    height: auto;
    border-radius: 5px;
    background-color: #0000008a;
}

.close {
    position: absolute;
    top: 15px; /* 稍微向內移動 */
    right: 25px; /* 稍微向內移動 */
    color: #fff; /* 使用純白色 */
    font-size: 50px; /* 稍微放大 */
    font-weight: lighter; /* 讓字體更細緻 */
    cursor: pointer;
    /* 新增：關閉按鈕美化 */
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
    transition: color 0.2s ease;
}

.close:hover,
.close:focus {
    color: #ff5757; /* 懸停時變為亮紅色，提供更好的交互反饋 */
    text-decoration: none;
}
/* ------------------------------------------------ */

.statement {
    display: flex;
    justify-content: center;
    color: gray;
    font-weight: bold;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

/* 表格樣式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

table th {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

table tr:hover {
    background-color: #f1f1f1;
}

table td img {
    border-radius: 5px;
    max-width: 100px;
    height: auto;
}

/* 表格外觀更新 */
.container h1 {
    text-align: left;
    font-size: 28px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    margin-bottom: 30px;
}

/* 仿交通局標題 */
.title_container {
    position: relative;
    margin-top: -17px;
    padding-bottom: 10px;
    left: -20px;
    vertical-align: top;
}

.main_content_title {
    position: absolute;
    top: 20px;
    left: -6px;
    min-height: 40px;
    min-width: 120px;
    background: #009845;
    border-bottom-right-radius: 20px;
    border-top-right-radius: 20px;
    font-size: 32px;
    color: #fff;
    line-height: 36px;
    padding: 2px 20px; /* 簡化padding */
    box-shadow: 0px 10px #ddd;
    font-weight: bolder;
    display: block;
}

.main_content_title_left1 {
    height: 49px;
    position: absolute;
    top: 20px;
    left: -31px;
    min-width: 26px;
    background: #009845;
    border-top-left-radius: 10px;
}

.main_content_title_left2 {
    top: 63px;
    position: absolute;
    left: -31px;
    height: 11px;
    min-width: 39px;
    background: #00390B;
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
}
/* 仿交通局標題 end */

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        width: 90%; /* 增加手機上的寬度 */
    }

    nav a {
        /* display: block; */
        margin: 10px 0;
    }

    .license-plate-number {
        font-size: 20pt !important;
    }

    /* 手機上媒體項目佔滿寬度 */
    .media-list .media-item {
        max-width: 100%; 
    }
}