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

body {
    font-family: 'Lato', sans-serif;
    background-color: #F5F5DC;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333333;
}

.container {
    width: 100%;
    max-width: 480px;
}

.calculator-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: 0 8px 32px rgba(139, 69, 19, 0.1);
    backdrop-filter: blur(10px);
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.header h1 {
    font-family: 'Roboto Slab', serif;
    font-size: 32px;
    font-weight: 700;
    color: #8B4513;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    color: #A9A9A9;
    font-weight: 300;
}

/* 输入区域样式 */
.input-section {
    margin-bottom: 14px;
}

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

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label-row label {
    font-size: 16px;
    font-weight: 400;
    color: #333333;
}

.pin-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.6;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
}

.pin-button:hover {
    background-color: rgba(255, 140, 0, 0.1);
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.2);
}

.pin-button.pinned {
    background: linear-gradient(135deg, #FF8C00 0%, #FF7700 100%);
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.pin-button.pinned:hover {
    background: linear-gradient(135deg, #FF7700 0%, #FF6600 100%);
    transform: scale(1.05) translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 140, 0, 0.4);
}

.lock-icon {
    width: 16px;
    height: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #666666;
    filter: none;
}

.pin-button:hover .lock-icon {
    color: #FF8C00;
    transform: rotate(-15deg);
}

.pin-button.pinned .lock-icon {
    color: white;
    filter: drop-shadow(0, 1px, 2px rgba(0, 0, 0, 0.2));
    transform: rotate(0deg);
}

.pin-button.pinned:hover .lock-icon {
    transform: rotate(5deg) scale(1.1);
}

/* 添加一个小脉冲动画当按钮被激活时 */
.pin-button.pinned::after {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 140, 0, 0.95);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.pin-button.pinned::before {
    content: '';
    position: absolute;
    bottom: 112%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(255, 140, 0, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.pin-button.pinned:hover::after,
.pin-button.pinned:hover::before {
    opacity: 1;
    visibility: visible;
}

/* 脉冲动画背景 */
.pin-button.pinned {
    position: relative;
}

.pin-button.pinned .pin-pulse {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #FF8C00, #FF7700);
    border-radius: 8px;
    opacity: 0.3;
    z-index: -1;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.1;
    }
    100% {
        transform: scale(1);
        opacity: 0.3;
    }
}

/* 输入框样式 */
input[type="number"] {
    width: 100%;
    height: 48px;
    padding: 12px 16px;
    border: 1px solid #A9A9A9;
    border-radius: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 16px;
    color: #333333;
    background: white;
    transition: border-color 0.2s ease;
}

input[type="number"]:focus {
    outline: none;
    border-color: #FF8C00;
    border-width: 2px;
}

/* 覆盖combined-input内部input的样式，避免width冲突 */
.combined-input input[type="number"] {
    width: 100%;
    height: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

/* 带单位的输入框 */
.input-with-unit {
    display: flex;
    gap: 8px;
}

.combined-input {
    flex: 1;
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #A9A9A9;
    border-radius: 8px;
    padding: 0 16px;
    transition: border-color 0.2s ease;
    height: 48px;
}

.combined-input:focus-within {
    border-color: #FF8C00;
    border-width: 2px;
}

.combined-input input {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 16px;
    color: #333333;
    text-align: center;
    min-width: 0;
    width: 100%;
}

.combined-input input:focus {
    outline: none;
}

.combined-input.composite {
    justify-content: space-between;
    gap: 8px;
}

.combined-input.composite input:first-child {
    text-align: right;
    flex: 1;
    /* width: auto; */
}

.combined-input.composite .separator {
    color: #A9A9A9;
    font-weight: 300;
    margin: 0 4px;
}

.combined-input.composite input:nth-of-type(2) {
    text-align: left;
    flex: 1;
    /* width: auto; */
}

.combined-input.composite .unit-label {
    font-size: 14px;
    color: #666666;
    font-weight: 300;
    margin-left: 4px;
}

.main-unit-label {
    font-size: 14px;
    color: #666666;
    font-weight: 300;
    margin-left: 4px;
    white-space: nowrap;
}

.combined-input.composite .main-unit-label {
    margin-right: 4px;
    margin-left: 4px;
}

.unit-select {
    width: 120px;
    height: 48px;
    padding: 12px 8px;
    border: 1px solid #A9A9A9;
    border-radius: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    color: #333333;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.unit-select:focus {
    outline: none;
    border-color: #FF8C00;
    border-width: 2px;
}

/* 价格输入样式 */
.price-input {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #A9A9A9;
    border-radius: 8px;
    padding: 0 16px;
    transition: border-color 0.2s ease;
}

.price-input:focus-within {
    border-color: #FF8C00;
    border-width: 2px;
}

.currency {
    font-size: 16px;
    color: #333333;
    margin-right: 8px;
}

.price-input input {
    flex: 1;
    border: none;
    height: 48px;
    padding: 12px 0;
    font-size: 16px;
}

.price-input input:focus {
    outline: none;
    border: none;
}

.price-unit {
    font-size: 14px;
    color: #A9A9A9;
    margin-left: 8px;
}

/* 结果显示区域 */
.result-section {
    margin-bottom: 24px;
    padding: 20px 0;
}

.cost-section {
    margin-bottom: 24px;
    padding: 20px 0;
    border-top: 1px solid #E0E0E0;
}

.cost-section h3 {
    font-family: 'Roboto Slab', serif;
    font-size: 20px;
    color: #8B4513;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-group {
    margin-bottom: 16px;
}

.result-group label {
    display: block;
    font-size: 16px;
    color: #333333;
    margin-bottom: 8px;
}

.result-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 16px;
    background: #F8F8F8;
    border-radius: 8px;
    min-height: 60px;
}

.result-value {
    font-family: 'Roboto Slab', serif;
    font-size: 36px;
    font-weight: 700;
    color: #FF8C00;
}

.result-value.editable-result {
    background: transparent;
    border: none;
    outline: none;
    width: 70%;
    min-width: 100px;
    text-align: left;
    cursor: text;
    /* Add consistent padding to prevent layout shift */
    padding: 2px 4px;
    border-radius: 4px;
    /* Use box-sizing to include padding in width calculation */
    box-sizing: border-box;
}

.result-value.editable-result:focus {
    background: rgba(255, 140, 0, 0.1);
    /* Remove padding change to prevent layout shift */
}

.result-unit {
    font-size: 16px;
    color: #333333;
}

/* 按钮区域 */
.button-section {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.share-button, .reload-button, .clear-button {
    width: 100%;
    height: 48px;
    border-radius: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-button {
    background-color: #FF8C00;
    color: white;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
}

.share-button:hover {
    background-color: #FF7700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.4);
}

.reload-button {
    background-color: #E0E0E0;
    color: #333333;
}

.reload-button:hover {
    background-color: #D0D0D0;
}

.clear-button {
    background-color: transparent;
    color: #A9A9A9;
    border: 1px solid #A9A9A9;
}

.clear-button:hover {
    background-color: #A9A9A9;
    color: white;
}

.share-icon {
    font-size: 18px;
}

/* 反馈区域 */
.feedback-section {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #E0E0E0;
}

.feedback-section p {
    margin-bottom: 12px;
    font-size: 14px;
    color: #666666;
}

.feedback-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.feedback-btn {
    padding: 8px 16px;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.yes-btn:hover {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.no-btn:hover {
    background-color: #F44336;
    color: white;
    border-color: #F44336;
}

.feedback-btn.selected {
    transform: scale(0.95);
}

/* SEO和可访问性样式 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.input-help, .result-help {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

/* About Section */
.about-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #E0E0E0;
}

.about-section h2 {
    font-family: 'Roboto Slab', serif;
    font-size: 24px;
    color: #8B4513;
    margin-bottom: 16px;
}

.about-section h3 {
    font-family: 'Roboto Slab', serif;
    font-size: 18px;
    color: #8B4513;
    margin: 20px 0 12px 0;
}

.about-section p {
    line-height: 1.6;
    margin-bottom: 16px;
    color: #333;
}

.about-section ol, .about-section ul {
    margin: 12px 0 16px 20px;
    line-height: 1.6;
    color: #333;
}

.about-section li {
    margin-bottom: 8px;
}

.about-section strong {
    color: #8B4513;
    font-weight: 600;
}

/* 响应式设计优化 */
@media (max-width: 480px) {
    .about-section {
        padding-top: 20px;
    }
    
    .about-section h2 {
        font-size: 20px;
    }
    
    .about-section h3 {
        font-size: 16px;
    }
    
    .about-section ol, .about-section ul {
        margin-left: 16px;
    }
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.result-value.updated {
    animation: pulse 0.3s ease;
}

/* 工具提示样式 */
.pin-button {
    position: relative;
}

.pin-button::after {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(51, 51, 51, 0.95);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.pin-button::before {
    content: '';
    position: absolute;
    bottom: 112%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(51, 51, 51, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.pin-button:hover::after,
.pin-button:hover::before {
    opacity: 1;
    visibility: visible;
}

.pin-button.pinned::after {
    background: rgba(255, 140, 0, 0.95);
}

.pin-button.pinned::before {
    border-top-color: rgba(255, 140, 0, 0.95);
}

/* 覆盖激活状态的工具提示样式，避免与脉冲动画冲突 */
.pin-button.pinned:hover::after {
    background: rgba(255, 140, 0, 0.95);
}

.pin-button.pinned:hover::before {
    border-top-color: rgba(255, 140, 0, 0.95);
}

/* 脉冲动画效果 */
.pin-button.pinned {
    animation: pin-activated 0.6s ease-out;
}

@keyframes pin-activated {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1.05);
    }
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 1000;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideInDown 0.3s ease;
}

.notification.success {
    background: #4CAF50;
}

.notification.info {
    background: #2196F3;
}

.notification.warning {
    background: #FF9800;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
