/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #2d3748;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.header h1 {
    font-size: 2rem;
    color: #2d5a27;
    margin-bottom: 10px;
    font-weight: 600;
}

.subtitle {
    color: #4a5568;
    font-size: 1rem;
    opacity: 0.8;
}

/* 主要内容区域 */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 输入区域 */
.input-section {
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(45, 90, 39, 0.1);
    border: 1px solid rgba(144, 205, 144, 0.3);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2d5a27;
    font-size: 0.95rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #90cd90;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8fff8;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #2d5a27;
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
    background: #ffffff;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #2d5a27, #4a7c59);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e3a1a, #2d5a27);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 90, 39, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #90cd90, #a8d8a8);
    color: #2d5a27;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7bb87b, #90cd90);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(144, 205, 144, 0.4);
}

/* 结果展示区域 */
.result-section {
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(45, 90, 39, 0.1);
    border: 1px solid rgba(144, 205, 144, 0.3);
}

/* 颜色预览 */
.color-preview {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8fff8;
    border-radius: 12px;
    border: 1px solid rgba(144, 205, 144, 0.2);
}

.color-box {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.color-info h3 {
    color: #2d5a27;
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.color-info p {
    color: #4a5568;
    font-size: 1.1rem;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

/* 颜色格式展示 */
.color-formats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.format-group {
    background: #f8fff8;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(144, 205, 144, 0.2);
}

.format-group h4 {
    color: #2d5a27;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.format-values {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.format-values span {
    background: #90cd90;
    color: #2d5a27;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.format-group p {
    font-family: 'Courier New', monospace;
    color: #4a5568;
    font-size: 0.9rem;
    background: #ffffff;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(144, 205, 144, 0.2);
}

/* 颜色属性 */
.color-properties {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.property-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fff8;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid rgba(144, 205, 144, 0.2);
}

.property-item label {
    color: #2d5a27;
    font-weight: 500;
    font-size: 0.9rem;
}

.property-item span {
    color: #4a5568;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* 配色方案 */
.color-palette {
    margin-bottom: 30px;
}

.color-palette h4 {
    color: #2d5a27;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.palette-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.palette-item {
    background: #f8fff8;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(144, 205, 144, 0.2);
}

.palette-item label {
    display: block;
    color: #2d5a27;
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.color-sample {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: inline-block;
    margin-right: 10px;
}

.analogous-colors,
.triadic-colors {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.analogous-hex,
.triadic-hex {
    display: flex;
    gap: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #4a5568;
}

/* 无障碍性信息 */
.accessibility-info h4 {
    color: #2d5a27;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.accessibility-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.accessibility-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fff8;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(144, 205, 144, 0.2);
}

.accessibility-item span:first-child {
    color: #2d5a27;
    font-weight: 500;
    font-size: 0.9rem;
}

.status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status.pass {
    background: #90cd90;
    color: #2d5a27;
}

.status.fail {
    background: #ffcccb;
    color: #d32f2f;
}

/* 加载和错误状态 */
.loading,
.error {
    text-align: center;
    padding: 40px 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.loading {
    background: rgba(144, 205, 144, 0.1);
    border: 1px solid rgba(144, 205, 144, 0.3);
}

.error {
    background: rgba(255, 204, 203, 0.3);
    border: 1px solid rgba(211, 47, 47, 0.3);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(144, 205, 144, 0.3);
    border-top: 4px solid #2d5a27;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #2d5a27;
    font-weight: 500;
}

.error p {
    color: #d32f2f;
    font-weight: 500;
}

/* 平板端适配 (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 30px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .main-content {
        gap: 35px;
    }
    
    .input-section,
    .result-section {
        padding: 30px;
    }
    
    .color-preview {
        gap: 25px;
    }
    
    .color-box {
        width: 100px;
        height: 100px;
    }
    
    .color-formats {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .palette-group {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
}

/* 电脑端适配 (1025px+) */
@media (min-width: 1025px) {
    .container {
        padding: 40px;
    }
    
    .header h1 {
        font-size: 3rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .main-content {
        gap: 40px;
    }
    
    .input-section,
    .result-section {
        padding: 35px;
    }
    
    .color-preview {
        gap: 30px;
        padding: 25px;
    }
    
    .color-box {
        width: 120px;
        height: 120px;
    }
    
    .color-info h3 {
        font-size: 1.4rem;
    }
    
    .color-info p {
        font-size: 1.2rem;
    }
    
    .color-formats {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 25px;
    }
    
    .format-group {
        padding: 20px;
    }
    
    .palette-group {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
    
    .button-group {
        max-width: 500px;
        margin: 25px auto 0;
    }
    
    .btn {
        padding: 18px 25px;
        font-size: 1.1rem;
    }
}

/* 手机端优化 (最高优先级) */
@media (max-width: 767px) {
    .container {
        padding: 15px;
    }
    
    .header {
        margin-bottom: 25px;
        padding: 15px 0;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .main-content {
        gap: 25px;
    }
    
    .input-section,
    .result-section {
        padding: 20px;
        border-radius: 12px;
    }
    
    .input-group {
        margin-bottom: 18px;
    }
    
    .input-group input,
    .input-group select {
        padding: 14px 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .button-group {
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
    }
    
    .btn {
        padding: 16px 20px;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    .color-preview {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }
    
    .color-box {
        width: 100px;
        height: 100px;
        margin: 0 auto;
    }
    
    .color-formats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .format-group {
        padding: 12px;
    }
    
    .format-values {
        justify-content: center;
    }
    
    .color-properties {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .property-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
        padding: 15px;
    }
    
    .palette-group {
        gap: 12px;
    }
    
    .palette-item {
        padding: 12px;
        text-align: center;
    }
    
    .analogous-colors,
    .triadic-colors {
        justify-content: center;
    }
    
    .analogous-hex,
    .triadic-hex {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .accessibility-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .accessibility-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
        padding: 12px;
    }
    
    .loading,
    .error {
        padding: 30px 15px;
        margin: 15px 0;
    }
    
    .spinner {
        width: 35px;
        height: 35px;
    }
}