/* ============================================================
   小区业主表决系统 —— 全局样式
   设计目标：简洁、清晰、适合中老年业主使用
   ============================================================ */

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --success: #1e8e3e;
    --success-light: #e6f4ea;
    --danger: #d93025;
    --danger-light: #fce8e6;
    --text-main: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
                 "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text-main);
    line-height: 1.8;
    min-height: 100vh;
}

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

/* ===================== 通用卡片 ===================== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
    margin-bottom: 20px;
}

/* ===================== 标题区 ===================== */
.page-header {
    text-align: center;
    margin-bottom: 24px;
    padding-top: 10px;
}

.page-header h1 {
    font-size: 1.7rem;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 1px;
}

.page-header .subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* ===================== 表单 ===================== */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

select.form-control {
    cursor: pointer;
    appearance: auto;
}

/* ===================== 投票选项 ===================== */
.vote-section {
    margin-top: 8px;
    padding: 24px 20px;
    background: var(--primary-light);
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: opacity 0.3s, border-color 0.3s;
}

.vote-section.disabled {
    opacity: 0.5;
    pointer-events: none;
    border-color: var(--border);
}

.vote-section h3 {
    font-size: 1.25rem;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-main);
}

.vote-options {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.vote-option {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    position: relative;
}

.vote-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.vote-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    font-size: 1.4rem;
    font-weight: 700;
    border: 3px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.25s;
    background: #fff;
    user-select: none;
}

.vote-option label .icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.vote-option input[type="radio"]:checked + label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
    transform: scale(1.03);
}

.vote-option.agree input[type="radio"]:checked + label {
    border-color: var(--success);
    background: var(--success-light);
    color: var(--success);
}

.vote-option.disagree input[type="radio"]:checked + label {
    border-color: var(--danger);
    background: var(--danger-light);
    color: var(--danger);
}

/* ===================== 提示信息 ===================== */
.hint {
    text-align: center;
    font-size: 1.05rem;
    color: var(--text-secondary);
    padding: 10px;
    margin-top: 12px;
}

.hint.warning {
    color: var(--danger);
    font-weight: 600;
}

/* ===================== 按钮 ===================== */
.btn {
    display: inline-block;
    padding: 16px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #bbb;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b3261e;
}

.btn-outline {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-sm {
    padding: 8px 18px;
    font-size: 0.95rem;
    font-weight: 600;
}

.submit-bar {
    text-align: center;
    margin-top: 28px;
}

/* ===================== 模态弹窗 ===================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 36px 28px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-hover);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.modal .icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.modal h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.modal p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal .modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===================== 成功页面 ===================== */
.success-page {
    text-align: center;
    padding: 50px 24px;
}

.success-page .check-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 16px;
}

.success-page h2 {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 10px;
}

.success-page p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* ===================== 后台管理 ===================== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.admin-header h1 {
    font-size: 1.5rem;
    color: var(--primary);
}

.admin-header .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 20px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

.stat-card.agree .stat-value   { color: var(--success); }
.stat-card.disagree .stat-value { color: var(--danger); }
.stat-card.total .stat-value    { color: var(--primary); }
.stat-card.rate .stat-value     { color: #9334c9; }

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #4a9af5);
    border-radius: 5px;
    transition: width 0.5s ease;
}

/* 表格 */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

thead {
    background: var(--primary);
    color: #fff;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    font-weight: 600;
    font-size: 0.9rem;
}

tbody tr:hover {
    background: var(--primary-light);
}

.tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.tag-agree    { background: var(--success-light); color: var(--success); }
.tag-disagree { background: var(--danger-light);  color: var(--danger); }

/* 设置面板 */
.settings-panel {
    margin-top: 24px;
}

.settings-panel h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--text-main);
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.settings-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.settings-row .form-group {
    flex: 1;
    min-width: 180px;
    margin-bottom: 0;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ===================== 登录页 ===================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    padding: 40px 32px;
    max-width: 400px;
    width: 100%;
}

.login-card h1 {
    text-align: center;
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 28px;
}

.login-card .btn {
    width: 100%;
    margin-top: 8px;
}

/* ===================== Flash 消息 ===================== */
.flash-msg {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 1rem;
    font-weight: 600;
}

.flash-msg.error {
    background: var(--danger-light);
    color: var(--danger);
}

/* ===================== 页脚 ===================== */
.footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 20px 0;
    margin-top: 20px;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

/* ===================== 响应式 ===================== */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    .card {
        padding: 20px 16px;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .vote-options {
        flex-direction: column;
        align-items: center;
    }

    .vote-option {
        max-width: 100%;
        width: 100%;
    }

    .vote-option label {
        font-size: 1.25rem;
        padding: 22px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card .stat-value {
        font-size: 1.8rem;
    }
}
