/* 容器样式 */
.container {
    font-family: 'Arial', sans-serif;
    background-color: #ecf0f1;
    margin: 0 auto;
    padding: 20px;
    width: 90%;
    max-width: 1200px;
    text-align: left;
}

/* 标题样式 */
h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #2c3e50;
}

/* 输入框和按钮样式 */
.input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-row, .select-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

select {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background: linear-gradient(135deg, #2980b9, #3498db);
}

/* 信息显示区域样式 */
#info-message {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    color: #333;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    background-color: #fff;
    overflow-x: auto; /* 新增：允许水平滚动 */
    display: block; /* 新增：使表格可滚动 */
}

th {
    position: sticky;
    top: 0;
    background-color: #ffffff;
    color: #2c3e50;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

td {
    padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

tr:nth-child(even) {
    background: #fafafa;
}

tr:hover {
    background: #f0f0f0;
    transition: background 0.3s ease;
}

/* 分页样式 */
.pagination {
    display: flex;
    flex-direction: column; /* 修改：改为列布局以支持多行 */
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.pagination-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    background: #3498db;
    color: white;
    cursor: pointer;
    min-width: 60px; /* 新增：最小宽度以便触摸 */
}

.pagination button:hover {
    background: #2980b9;
}

.pagination button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 新增样式：座位类型列表 */
.seat-types {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.seat-type {
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 3px;
    background: #f9f9f9;
}
.sold-out {
    color: red;
    text-decoration: line-through;
}
.ticket-img {
    width: 80px; /* 修改：减少图片宽度以适应小屏幕 */
    height: auto;
}

/* 修改信息图标样式，使其适合内联显示 */
.info-icon {
    cursor: pointer;
    color: #3498db;
    font-size: 1rem;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
}

.popup-info {
    position: absolute;
    display: none;
    background: white;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 200px; /* 修改：减少最小宽度 */
    max-width: 90vw; /* 新增：限制最大宽度为屏幕宽度 */
    right: 0;
    left: auto; /* 新增：确保弹窗不超出左边界 */
}

.popup-info.show {
    display: block;
}

.popup-info h4 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.popup-info p {
    margin: 5px 0;
}

.relative-container {
    position: relative;
}

.title-container {
    display: flex;
    align-items: center;
}

.title-text {
    flex: 1;
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: bold; /* 新增：添加粗体以匹配 bidding 样式 */
}

.title-text:hover {
    color: #2980b9;
    /* 移除：text-decoration: underline; 以匹配 bidding 悬停无下划线 */
}

/* 新增：模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    cursor: pointer;
}
.modal-content {
    max-width: 90%;
    max-height: 90%;
    cursor: default;
}
.modal-content img {
    width: 100%;
    height: auto;
    border-radius: 5px;
}
.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    color: #333;
}

/* 新增：票务状态样式 */
.status-text {
    margin-left: 5px;
    font-size: 0.9rem;
    font-weight: bold;
}
.status-on-sale {
    color: green;
}
.status-off-sale {
    color: red;
}

/* 新增：倒计时样式 */
.countdown {
    margin-left: 5px;
    font-size: 0.9rem;
    color: #e67e22;
    font-weight: bold;
    display: block;
}

/* 新增：美化开关样式 */
.switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}
.switch-container .label {
    font-size: 0.95rem;
    color: #2c3e50;
    font-weight: 600;
}
/* 切换开关样式 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.toggle-switch input {
    display: none;
}
.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #dfe6e9;
    transition: 0.3s;
    border-radius: 999px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.06);
}
.toggle-switch .slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.toggle-switch input:checked + .slider {
    background: linear-gradient(90deg,#2ecc71,#27ae60);
}
.toggle-switch input:checked + .slider:before {
    transform: translateX(22px);
}
.switch-state {
    font-size: 0.85rem;
    color: #888;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    h1 {
        font-size: 2rem;
    }
    .input-container {
        flex-direction: column;
        align-items: stretch;
    }
    .search-row {
        flex-direction: row;
        gap: 0px; /* 紧贴 */
    }
    .select-row {
        flex-direction: row;
        gap: 10px;
        flex-wrap: wrap; /* 新增：允许换行 */
    }
    .select-row select {
        flex: 1; /* 各占一半宽度 */
        background-color: #f8f9fa; /* 添加背景色 */
        border: 1px solid #ddd; /* 添加边框 */
        min-width: 0; /* 新增：防止元素过宽 */
    }
    .switch-container {
        flex: 1 1 100%; /* 新增：开关占满一行 */
        justify-content: flex-start; /* 新增：左对齐 */
    }
    .select-row {
        flex-direction: row;
        gap: 10px;
    }
    .select-row select {
        flex: 1; /* 各占一半宽度 */
        background-color: #f8f9fa; /* 添加背景色 */
        border: 1px solid #ddd; /* 添加边框 */
    }
    td {
        padding: 10px;
    }
    .ticket-img {
        width: 100%; /* 修改：让图片在移动设备上填充其容器宽度 */
        height: auto;
        max-width: 200px; /* 新增：限制最大宽度以避免过大 */
    }
    .popup-info {
        max-width: 90vw; /* 保持限制宽度，避免超出屏幕 */
        /* 移除固定定位：position: fixed; top: auto; bottom: 10px; right: 10px; left: 10px; */
        /* 弹窗将使用默认的绝对定位，显示在图标旁边 */
    }
    /* 新增：移动设备表格布局 */
    table {
        display: block;
    }
    tr {
        display: grid;
        grid-template-columns: 1fr 1fr; /* 左侧图片1fr，右侧1fr，可调整为1fr 2fr让图片更大 */
        grid-template-rows: auto auto;
        gap: 10px;
        margin-bottom: 20px;
        border-bottom: 1px solid #ddd;
        padding-bottom: 10px;
    }
    thead {
        display: none; /* 新增：隐藏表头 */
    }
    td:nth-child(1) { /* 隐藏序号 */
        display: none;
    }
    td:nth-child(2) { /* 图片占据左侧两行 */
        grid-column: 1;
        grid-row: 1 / -1;
        text-align: center;
    }
    td:nth-child(3) { /* 标题在右侧第一行 */
        grid-column: 2;
        grid-row: 1;
    }
    td:nth-child(4) { /* 座位类型在右侧第二行 */
        grid-column: 2;
        grid-row: 2;
    }
    .seat-types {
        flex-direction: column; /* 修改：座位类型垂直排列 */
        gap: 5px;
    }
}

/* 新增：针对极小屏幕的媒体查询 */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    .input-container {
        gap: 5px;
    }
    input[type="text"], select, button {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    th, td {
        padding: 8px;
        font-size: 0.9rem;
    }
    .pagination button {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    .seat-type {
        padding: 3px;
        font-size: 0.8rem;
    }
    .info-icon {
        width: 18px;
        height: 18px;
        font-size: 0.9rem;
    }
}
