/*
Theme Name: Saisudi Pro
Theme URI: https://yourdomain.com/
Author: Your Name
Author URI: https://yourdomain.com/
Description: 一款为骑行与跑步爱好者打造的赛事信息聚合平台主题。A custom theme for the Events Aggregator Platform.
Version: 10.3.6 (地图标记点美化)
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: saisudi-pro
*/

/* --- Base Styles & Variables --- */
:root {
    --text-light-primary: #2c3e50;
    --text-light-secondary: #34495e;
    --accent-gradient: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    --accent-color: #3b82f6;
    --card-radius: 20px;
    --button-radius: 12px;
}

/* --- Global Styles --- */
html {
    height: 100%;
}
body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #E9EAFE;
    background-image: url('assets/images/background.webp');
    background-attachment: fixed;
    background-size: cover;
    background-position: center center;
    color: var(--text-light-secondary);
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
#page {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
#content {
    flex-grow: 1;
}
main#content.site-content {
    margin-top: 2rem;
}
h1, h2, h3, h4, h5, h6, strong {
    color: var(--text-light-primary);
}
a {
    color: inherit;
    text-decoration: inherit;
}

/* --- [修复 v3] 导航栏毛玻璃效果 --- */
header.site-header.sticky {
    background: rgba(255, 255, 255, 0.7) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    backdrop-filter: blur(18px) !important;
    border-bottom: 1px solid rgba(230, 230, 230, 0.7);
}


/* --- Custom Components & Theme Styles --- */
.event-card, 
.filter-container, 
.single-event-content, 
article.post, 
.comments-area-wrapper .comments-area, 
#events-map-container, 
.form-container {
    background: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.03);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.06);
}
.btn-primary, .comment-form input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: var(--button-radius);
    padding: 12px 24px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}
.btn-primary:hover, .comment-form input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 25px rgba(59, 130, 246, 0.3);
    filter: saturate(1.1);
}
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.7);
    color: var(--text-light-secondary);
    border-radius: var(--button-radius);
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 25px rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.7);
}
.nav-link {
    color: #4b5563;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}
.nav-link:hover {
    color: #2563eb;
}
.mobile-nav-link {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    color: #374151;
}
.mobile-nav-link:hover {
    background-color: rgba(0,0,0,0.05);
}
.form-input, .comments-area .comment-form input[type="text"], .comments-area .comment-form input[type="email"], .comments-area .comment-form input[type="url"], .comments-area .comment-form textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(209, 213, 219, 0.8);
    border-radius: var(--button-radius);
    padding: 10px 15px;
    color: var(--text-light-primary);
    transition: all 0.2s ease-in-out;
    width: 100%;
}
.form-input:focus, .comments-area .comment-form input:focus, .comments-area .comment-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-light-primary);
}
.event-status-badge {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.status-open { background: linear-gradient(45deg, #2ed8b6, #59e0c5); }
.status-pending { background: linear-gradient(45deg, #ffb64d, #ffcb80); }
.status-ongoing { background: linear-gradient(45deg, #4099ff, #73b4ff); }
.status-closed { background: linear-gradient(45deg, #ff5370, #ff869a); }
.status-finished { background: linear-gradient(45deg, #888, #aaa); }
.status-unknown { background: linear-gradient(45deg, #ccc, #eee); color: #555; }

/* --- 美化筛选栏下拉框 --- */
.custom-select-wrapper {
    position: relative;
}
.custom-select-wrapper select.form-input {
    padding-right: 2.5rem;
}
.custom-select-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0.75rem;
    width: 1.5rem;
    height: 1.5rem;
    transform: translateY(-50%);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
}

/* --- Mobile Menu --- */
.mobile-menu-trigger {
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 8px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    transition: all 0.3s ease;
}
.mobile-menu-trigger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text-light-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.mobile-menu-trigger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-trigger.is-active span:nth-child(2) { opacity: 0; }
.mobile-menu-trigger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
#mobile-menu {
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.7);
    padding-bottom: 1rem;
    border-bottom-left-radius: var(--card-radius);
    border-bottom-right-radius: var(--card-radius);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.05);
}

/* --- [修复 v3] 评论区表单响应式修复 --- */
.comments-area .comment-form p.comment-form-author,
.comments-area .comment-form p.comment-form-email,
.comments-area .comment-form p.comment-form-url {
    /* 这个选择器更具体，可以覆盖默认样式 */
}
.comments-area .comment-form p.comment-form-author input,
.comments-area .comment-form p.comment-form-email input,
.comments-area .comment-form p.comment-form-url input {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* --- [新增] 自定义地图标记点样式 --- */
.custom-map-marker svg {
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.4));
    transition: transform 0.2s ease-in-out;
}
.custom-map-marker:hover svg {
    transform: scale(1.1);
}

/* --- [新增] 动态导航菜单样式 --- */
/* 桌面端菜单 */
.primary-menu-desktop {
    display: flex;
    align-items: center;
    gap: 1.5rem; /* 对应 Tailwind 的 space-x-6 */
    list-style: none;
    padding: 0;
    margin: 0;
}
.primary-menu-desktop a {
    color: #4b5563;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
    text-decoration: none;
    white-space: nowrap; /* 防止菜单项换行 */
}
.primary-menu-desktop a:hover {
    color: #2563eb;
}
.primary-menu-desktop .menu-item-has-children {
    position: relative;
}
/* 移动端菜单 */
.primary-menu-mobile {
    list-style: none;
    padding: 0;
    margin: 0;
}
.primary-menu-mobile a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
}
.primary-menu-mobile a:hover {
    background-color: rgba(0,0,0,0.05);
}



/* --- 我的分享页面样式 --- */
.submissions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: fixed; /* 使用固定布局算法，确保列宽一致 */
}
.submissions-th, 
.submissions-td {
    padding: 1rem;
    text-align: left; /* 确保所有单元格左对齐 */
    vertical-align: middle;
    word-wrap: break-word; /* 防止长标题撑开单元格 */
}
.submissions-th {
    background-color: rgba(0, 0, 0, 0.02);
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    white-space: nowrap;
}
.submissions-tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.submissions-tr:last-child {
    border-bottom: none;
}

/* 为表格列分配宽度 */
.submissions-table th:nth-child(1), .submissions-table td:nth-child(1) { width: 40%; } /* 赛事标题 */
.submissions-table th:nth-child(2), .submissions-table td:nth-child(2) { width: 25%; } /* 提交日期 */
.submissions-table th:nth-child(3), .submissions-table td:nth-child(3) { width: 20%; } /* 状态 */
.submissions-table th:nth-child(4), .submissions-table td:nth-child(4) { width: 15%; text-align: center; } /* 操作列居中 */


.status-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
.status-pill-publish {
    background-color: #27ae60; /* Green */
}
.status-pill-pending {
    background-color: #f39c12; /* Orange */
}
.status-pill-draft {
    background-color: #7f8c8d; /* Gray */
}
.status-pill-default {
    background-color: #9b59b6; /* Purple */
}


/* --- [新增] 用户下拉菜单样式 --- */
.user-dropdown-container {
    position: relative;
}
.user-dropdown-menu {
    position: absolute;
    right: 0;
    margin-top: 0.5rem;
    width: 12rem; /* 192px */
    background-color: white;
    border-radius: 0.75rem; /* 12px */
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    z-index: 50;
    border: 1px solid #f3f4f6;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0.2s;
}
.user-dropdown-menu.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
/* For desktop hover */
.user-dropdown-container:hover .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-align: left;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.dropdown-item:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

/* Arrow rotation */
#user-dropdown-trigger svg {
    transition: transform 0.2s ease-in-out;
}
.user-dropdown-container:hover #user-dropdown-trigger svg,
.user-dropdown-menu.is-active + #user-dropdown-trigger svg {
    transform: rotate(180deg);
}


/* --- [新增] 自定义站点 Logo 样式 --- */
.site-branding .custom-logo-link {
    display: flex;
    align-items: center;
    height: 40px; /* 限制容器高度以对齐菜单 */
}
.site-branding .custom-logo {
    max-height: 100%;
    width: auto;
    height: auto;
}

/* --- Utilities --- */
.saisudi-toast { position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%); padding: 12px 24px; border-radius: 8px; background-color: #2c3e50; color: white; font-size: 14px; font-weight: 500; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); z-index: 9999; transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); opacity: 0; }
.saisudi-toast.show { bottom: 30px; opacity: 1; }
.saisudi-toast.toast-success { background-color: #27ae60; }
.saisudi-toast.toast-error { background-color: #c0392b; }
.saisudi-toast.toast-info { background-color: #2980b9; }
#submit-event-button .button-spinner-svg { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
#thank-you-modal { transition: opacity 0.3s ease; }
#thank-you-modal > div { transition: opacity 0.3s ease, transform 0.3s ease; }
#close-modal-button { position: absolute; top: 0.75rem; right: 0.75rem; font-size: 1.5rem; line-height: 1; font-weight: bold; color: #9ca3af; }
#close-modal-button:hover { color: #1f2937; }
