/* ============================================
   密度换算工具专用样式
   依赖：tools-common.css（公共样式）
   ============================================ */

/* ============================================
   1. 输入单位组布局
   ============================================ */
.tool-page .input-unit-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.tool-page .input-unit-group .form-input {
    flex: 1;
    min-width: 0;
}

.tool-page .input-unit-group .form-select {
    flex: 1.5;
    min-width: 0;
}

/* ============================================
   2. 交换按钮样式
   ============================================ */
.tool-page .swap-button-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.tool-page .btn-swap {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-page .btn-swap:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.tool-page .btn-swap:active {
    transform: rotate(180deg) scale(0.95);
}

/* ============================================
   3. 按钮组样式
   ============================================ */
.tool-page .button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.tool-page .button-group .btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tool-page .button-group .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tool-page .button-group .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tool-page .button-group .btn-secondary {
    background: #f1f3f5;
    color: #495057;
}

.tool-page .button-group .btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.tool-page .button-group .btn-outline-secondary {
    background: white;
    border: 2px solid #dee2e6;
    color: #6c757d;
}

.tool-page .button-group .btn-outline-secondary:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

/* ============================================
   4. 快捷示例样式
   ============================================ */
.tool-page .quick-examples {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.tool-page .quick-examples h4 {
    color: #495057;
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-page .quick-examples h4 i {
    color: #ffc107;
}

.tool-page .example-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.tool-page .example-btn {
    background: white;
    border: 2px solid #dee2e6;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.tool-page .example-btn i {
    color: #6c757d;
    flex-shrink: 0;
}

.tool-page .example-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.tool-page .example-btn:hover i {
    color: white;
}

/* ============================================
   5. 历史记录样式
   ============================================ */
.tool-page .history-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.tool-page .history-section h4 {
    color: #495057;
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-page .history-section h4 i {
    color: #17a2b8;
}

.tool-page .history-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.tool-page .history-empty {
    text-align: center;
    padding: 30px;
    color: #6c757d;
    font-style: italic;
}

.tool-page .history-item {
    background: white;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tool-page .history-item:hover {
    background: #f1f3f5;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tool-page .history-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.tool-page .history-from {
    font-weight: 600;
    color: #495057;
}

.tool-page .history-arrow {
    color: #6c757d;
    font-size: 1.2rem;
}

.tool-page .history-to {
    color: #667eea;
    font-weight: 600;
}

.tool-page .history-date {
    color: #adb5bd;
    font-size: 0.85rem;
}

/* 自定义滚动条 */
.tool-page .history-list::-webkit-scrollbar {
    width: 8px;
}

.tool-page .history-list::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 4px;
}

.tool-page .history-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.tool-page .history-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ============================================
   6. 密度参考表格样式
   ============================================ */
.tool-page .density-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.tool-page .density-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tool-page .density-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.tool-page .density-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e9ecef;
}

.tool-page .density-table tbody tr:hover {
    background: #f8f9fa;
}

.tool-page .density-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   7. 提示消息样式
   ============================================ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    font-size: 0.95rem;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #28a745;
    color: white;
}

.toast-error {
    background: #dc3545;
    color: white;
}

/* ============================================
   8. 响应式设计
   ============================================ */

/* 平板端 (768px - 1024px) */
@media (max-width: 1024px) {
    .tool-page .example-buttons {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .tool-page .button-group .btn {
        min-width: 100px;
        font-size: 0.9rem;
    }
}

/* 手机端 (< 768px) */
@media (max-width: 768px) {
    .tool-page .input-unit-group {
        flex-direction: column;
    }

    .tool-page .input-unit-group .form-input,
    .tool-page .input-unit-group .form-select {
        width: 100%;
    }

    .tool-page .button-group {
        flex-direction: column;
    }

    .tool-page .button-group .btn {
        width: 100%;
        min-width: 0;
    }

    .tool-page .example-buttons {
        grid-template-columns: 1fr;
    }

    .tool-page .example-btn {
        justify-content: flex-start;
    }

    .tool-page .history-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .tool-page .history-content {
        min-width: 0;
        width: 100%;
    }

    .tool-page .history-date {
        width: 100%;
    }

    .tool-page .density-table {
        font-size: 0.85rem;
    }

    .tool-page .density-table th,
    .tool-page .density-table td {
        padding: 8px;
    }

    .toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* 小屏手机 (< 480px) */
@media (max-width: 480px) {
    .tool-page .swap-button-container {
        margin: 15px 0;
    }

    .tool-page .btn-swap {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .tool-page .quick-examples,
    .tool-page .history-section {
        padding: 15px;
    }

    .tool-page .history-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .tool-page .history-arrow {
        display: none;
    }
}
