/* 西山居羽毛球比赛系统 - 现代化统一样式 */

/* ==================== 全局样式 ==================== */
* {
    box-sizing: border-box;
    outline: none;
}

:root {
    --primary-color: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-hover: #4f46e5;
    --success-color: #10b981;
    --success-hover: #059669;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --warning-color: #f59e0b;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border-color: #e5e7eb;
    --bg-color: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    --bg-color-solid: #f9fafb;
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== 导航栏 ==================== */
.navbar {
    background: var(--primary-gradient);
    box-shadow: var(--shadow-md);
    padding: 16px 0;
    margin-bottom: 40px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.nav-brand {
    color: white;
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-menu {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: -1;
}

.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-item:hover::before {
    transform: translateY(0);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ==================== 主容器 ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

/* ==================== 卡片样式 ==================== */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px;
    margin-bottom: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

/* ==================== 标题样式 ==================== */
h1 {
    color: var(--text-color);
    font-size: 32px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 3px solid;
    border-image: var(--primary-gradient) 1;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

h2 {
    color: var(--text-color);
    font-size: 26px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 20px;
}

h3 {
    color: var(--text-color);
    font-size: 20px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 16px;
}

h4 {
    color: var(--text-color);
    font-size: 18px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 12px;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 250px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

label.required::after {
    content: " *";
    color: var(--danger-color);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #fff;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
input[type="email"]::placeholder,
textarea::placeholder {
    color: var(--text-light);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%236b7280' d='M7 10L3 5h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 48px;
}

textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'Consolas', 'Monaco', 'SF Mono', monospace;
    line-height: 1.5;
}

input[type="file"] {
    padding: 10px 16px;
    background: #f9fafb;
    cursor: pointer;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.btn:hover::before {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(107, 114, 128, 0.4);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==================== Checkbox/Radio 样式 ==================== */
.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ==================== 结果展示区 ==================== */
.result {
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-left: 4px solid #667eea;
    border-radius: 0 var(--radius) var(--radius) 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.result pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'SF Mono', monospace;
    font-size: 13px;
    overflow-x: auto;
    line-height: 1.6;
}

/* ==================== 首页导航卡片 ==================== */
.welcome-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.welcome-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    display: block;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.4s ease;
    transform-origin: left;
}

.welcome-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(102, 126, 234, 0.2);
}

.welcome-card:hover::before {
    transform: scaleX(1);
}

.welcome-card .icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.welcome-card .title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-color);
}

.welcome-card .desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==================== 表格样式 ==================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

table th,
table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

table tr:last-child td {
    border-bottom: none;
}

table tr:nth-child(even) {
    background-color: #f9fafb;
}

table tr:hover {
    background-color: #f3f4f6;
}

/* ==================== 提示信息 ==================== */
.info-box {
    padding: 20px 24px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    border-left: 4px solid;
    box-shadow: var(--shadow-sm);
}

.info-box.info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left-color: #3b82f6;
    color: #1e40af;
}

.info-box.success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left-color: #10b981;
    color: #065f46;
}

.info-box.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left-color: #f59e0b;
    color: #92400e;
}

.info-box.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left-color: #ef4444;
    color: #991b1b;
}

.info-box strong {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

ul.format-list,
ol.format-list {
    padding-left: 20px;
    margin: 12px 0;
    color: var(--text-secondary);
}

ul.format-list li,
ol.format-list li {
    margin: 10px 0;
    line-height: 1.8;
}

/* ==================== 团体赛专用样式 ==================== */
.team-section {
    border: 2px solid var(--border-color);
    padding: 28px;
    margin-bottom: 24px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.team-section:hover {
    box-shadow: var(--shadow);
    border-color: #667eea;
}

.player-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed var(--border-color);
}

.match-order-item {
    border: 2px solid var(--border-color);
    padding: 20px;
    margin: 16px 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.match-order-item:hover {
    border-color: #667eea;
}

.preview-section {
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-left: 4px solid #10b981;
    border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: var(--shadow-sm);
}

.preview-section pre {
    margin: 12px 0 0;
    padding: 20px;
    background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
    color: #e5e5e5;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
}

.hidden {
    display: none;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-menu {
        width: 100%;
    }

    .nav-item {
        flex: 1;
        text-align: center;
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 14px;
    }

    .container {
        padding: 0 16px 40px;
    }

    .card {
        padding: 24px;
        border-radius: var(--radius);
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        width: 100%;
    }

    .welcome-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    h1 {
        font-size: 24px;
    }

    .team-section {
        padding: 20px;
    }
}

/* ==================== 辅助类 ==================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease;
}

.welcome-card {
    animation: fadeIn 0.6s ease;
}

.welcome-card:nth-child(1) { animation-delay: 0.1s; }
.welcome-card:nth-child(2) { animation-delay: 0.2s; }
.welcome-card:nth-child(3) { animation-delay: 0.3s; }
.welcome-card:nth-child(4) { animation-delay: 0.4s; }
.welcome-card:nth-child(5) { animation-delay: 0.5s; }
.welcome-card:nth-child(6) { animation-delay: 0.6s; }

/* ==================== 模态框样式 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: var(--text-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-color-solid);
    color: var(--text-color);
}

.login-modal .modal-header {
    padding: 32px 32px 0;
}

.login-modal form {
    padding: 24px 32px 32px;
}

/* ==================== 警告弹窗（防暴力破解等场景） ==================== */
.alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.alert-box {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.alert-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.alert-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 12px 0;
}

.alert-message {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 28px 0;
}

.alert-box.alert-warning {
    border-top: 4px solid var(--warning-color);
}

.alert-close-btn {
    min-width: 120px;
    padding: 10px 28px;
    font-size: 15px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
