/* 全局变量定义 */
:root {
    --primary-color: #4CAF50;
    --hover-color: #45a049;
    --background-color: #f0f8ff;
    --card-background: #ffffff;
    --text-color: #333;
    --border-color: #ddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* 全局样式重置 */
* {
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    background: linear-gradient(135deg, #87CEEB 0%, #E0F6FF 100%) fixed;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    position: relative;
    overflow-x: hidden;
}

/* 内容区域样式 */
.content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 表单容器样式 */
.form-container,
.result-container {
    width: 100%;
    max-width: 500px;
    background-color: var(--card-background);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 6px var(--shadow-color);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-container h2,
.result-container h2 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--text-color);
    font-size: 1.5rem;
    position: relative;
}

.form-container h2::after,
.result-container h2::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: var(--primary-color);
    margin: 10px auto;
    border-radius: 3px;
}

/* 输入框样式 */
.form-control {
    width: 100%;
    margin-bottom: 20px;
    padding: 20px;
    font-size: 24px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    height: auto;
    line-height: 1.5;
    background-color: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* 字体大小控制按钮样式 */
.font-size-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.font-size-btn {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.font-size-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

/* 开关样式 */
.switch-container {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding: 10px;
    background-color: rgba(248, 249, 250, 0.9);
    border-radius: 8px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin-right: 15px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* 提交按钮样式 */
.submit-btn,
.back-btn {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    display: block;
}

.submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.submit-btn:not(:disabled):hover,
.back-btn:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

/* 结果卡片样式 */
.result-card {
    background-color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 6px var(--shadow-color);
    font-size: 20px;
    transition: all 0.3s ease;
    border: 2px solid rgba(180, 180, 180, 0.5);
    position: relative;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--shadow-color);
    border-color: rgba(180, 180, 180, 0.7);
}

/* 结果计数样式 */
.result-count {
    background-color: rgba(76, 175, 80, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.result-count p {
    margin: 0;
    font-size: 16px;
    color: var(--text-color);
}

.result-count strong {
    color: var(--primary-color);
    font-size: 18px;
}

.result-item {
    margin: 15px 0;
    line-height: 1.6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* 最后一个条目不要底部边框 */
.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.result-item .label {
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-item .label i {
    color: var(--primary-color);
    font-size: 1.2em;
}

.result-item .value {
    font-size: 20px;
    display: inline-block;
    flex: 1;
}

/* 房号和电话号码样式 */
.phone-number {
    font-weight: 700;
    font-size: 110% !important;
    color: var(--primary-color);
}

.house-number {
    font-weight: normal;
    font-size: inherit !important;
    color: var(--text-color);
}

.phone-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    display: inline-block;
    transition: all 0.2s ease;
    font-size: 110%;
    padding: 2px 5px;
    border-radius: 4px;
}

/* 车牌号加粗加大 */
.result-item:first-child .value {
    font-weight: 700;
    font-size: 110%;
}

.phone-link:hover {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--hover-color);
    text-decoration: none;
}

/* 无结果提示样式 */
.no-result {
    text-align: center;
    color: #666;
    font-size: 18px;
    padding: 30px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    margin: 20px 0;
}

.no-result i {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.no-result p {
    margin: 10px 0;
}

.debug-info {
    font-size: 14px;
    color: #999;
    margin-top: 15px;
}

/* 返回按钮样式 */
.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: var(--primary-color);
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.back-btn i {
    font-size: 1.2em;
}

.back-btn:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
    color: white;
    text-decoration: none;
}

/* 页脚样式 */
.footer {
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--card-background);
    margin: 20% auto;
    padding: 20px;
    border-radius: 15px;
    width: 80%;
    max-width: 400px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

/* 动画效果 */
@keyframes modalSlideIn {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    .form-container,
    .result-container {
        padding: 20px;
    }
    
    .form-control {
        font-size: 18px;
        padding: 15px;
    }
    
    .result-card {
        padding: 20px;
        font-size: 18px;
    }
    
    .result-item .value {
        font-size: 1em;
    }
    
    .submit-btn,
    .back-btn {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .font-size-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .result-item .label i {
        font-size: 1.1em;
    }
}

/* 打印样式 */
@media print {
    body {
        background: none;
    }
    
    .form-container,
    .result-container {
        box-shadow: none;
    }
    
    .font-size-controls,
    .switch-container,
    .submit-btn,
    .back-btn {
        display: none;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #65d969;
        --hover-color: #5ac95e;
        --background-color: #1a1a1a;
        --card-background: #2c2c2c;
        --text-color: #e0e0e0;
        --border-color: #444;
        --shadow-color: rgba(0, 0, 0, 0.3);
    }
    
    body {
        background: linear-gradient(135deg, #1a1a1a 0%, #303030 100%) fixed;
    }
    
    .result-card {
        background-color: var(--card-background);
        border: 2px solid rgba(220, 220, 220, 0.4);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
        position: relative;
    }
    
    .result-card:hover {
        box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
        border-color: rgba(220, 220, 220, 0.5);
    }
    
    .phone-link {
        color: #80e884;
    }
    
    .phone-number {
        color: #80e884;
    }
    
    .house-number {
        color: var(--text-color);
    }
    
    .form-control {
        background-color: rgba(50, 50, 50, 0.9);
        color: var(--text-color);
        border-color: var(--border-color);
    }
    
    .no-result {
        color: var(--text-color);
    }
    
    .result-item {
        border-bottom: 1px solid rgba(200, 200, 200, 0.15);
    }
    
    .result-number {
        background-color: #80e884;
        color: #222;
        border: 2px solid rgba(255, 255, 255, 0.8);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    }
}

/* 移动端暗色模式下加强边框 */
@media (max-width: 480px) and (prefers-color-scheme: dark) {
    .result-card {
        border: 3px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.2);
        margin-bottom: 30px;
        position: relative;
    }
    
    .result-card:hover {
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.3);
    }
    
    .phone-number {
        font-size: 105% !important;
    }
    
    .phone-link {
        font-size: 105%;
    }
    
    .result-item:first-child .value {
        font-size: 105%;
    }
    
    .result-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* 结果编号样式 */
.result-number {
    position: absolute;
    top: -10px;
    left: -10px;
    background-color: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
    z-index: 2;
}

/* 暗色模式下的结果编号 */
@media (prefers-color-scheme: dark) {
    .result-number {
        background-color: #80e884;
        color: #222;
        border: 2px solid rgba(255, 255, 255, 0.8);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    }
}