body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
}

.container {
    max-width: 1500px;
    margin: 20px auto;
    padding: 15px;
}

.translator-box {
    display: grid;
    grid-template-columns: 1.2fr 60px 1.2fr 380px;
    height: 800px;
    min-height: 800px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    gap: 0;
}

@media (max-width: 768px) {
    .translator-box {
        grid-template-columns: 1fr;
        grid-template-rows: auto 60px auto auto;
        height: auto;
        min-height: auto;
    }
    
    .control-btns {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 320px;
        height: 60px;
        margin: 15px auto;
        justify-content: space-between;
        gap: 10px;
        padding: 0 15px;
        box-sizing: border-box;
        order: 2;
    }
    
    .left-box {
        order: 1;
    }
    
    .right-box {
        order: 3;
    }
    
    .definition-box {
        order: 4;
        min-height: 250px;
    }
    
    .swap-btn {
        flex: 1 0 auto;
        height: 100%;
        min-width: 130px;
        max-width: 200px;
        font-size: 20px;
    }
    
    .swap-btn:hover {
        transform: scale(1.05);
    }
    
    textarea {
        min-height: 400px;
    }
}

.text-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

textarea {
    flex: 1;
    min-height: 700px;
    padding: 15px;
    border: none;
    resize: none;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.left-box textarea {
    background-color: #fff;
}

.right-box textarea {
    background-color: #f9f9f9;
}

/* 桌面布局 - 按钮垂直排列 */
.control-btns {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 60px;
    height: 100%;
    justify-content: center;
    margin: 0;
    gap: 10px;
    padding: 10px 5px;
    box-sizing: border-box;
}

.service-select {
    width: 100%;
    padding: 8px 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background-color: white;
    cursor: pointer;
}

.swap-btn {
    width: 100%;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    min-height: 0;
    height: 100%;
}

/* 移动布局 - 按钮水平排列 */
@media (max-width: 768px) {
    .control-btns {
        flex-direction: row;
        width: 100%;
        height: 60px;
        margin: 15px auto;
        gap: 10px;
        padding: 0 15px;
    }
    
    .service-select {
        flex: 1;
        height: 100%;
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .swap-btn {
        flex: 1;
        height: 100%;
        font-size: 20px;
    }
}

.swap-btn:hover {
    background-color: #45a049;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.7);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

/* Definition Box Styles */
.definition-box {
    background-color: #fafafa;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding: 15px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.definition-box::-webkit-scrollbar {
    width: 6px;
}

.definition-box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.definition-box::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.definition-box::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.definition-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.5;
}

/* Empty/Placeholder State */
.definition-empty .definition-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease-in;
}

.definition-placeholder .placeholder-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.7;
    animation: float 3s ease-in-out infinite;
}

.definition-placeholder .placeholder-text {
    font-size: 16px;
    font-style: italic;
    color: #666;
    line-height: 1.5;
    max-width: 200px;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Loading State */
.definition-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    padding: 40px 20px;
    animation: fadeIn 0.3s ease-in;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e8f5e8;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.loading-text {
    font-size: 15px;
    text-align: center;
    color: #4CAF50;
    font-weight: 500;
    animation: pulse 2s infinite;
}

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

/* Error State */
.definition-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    animation: fadeIn 0.3s ease-in;
}

.definition-error .error-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #f44336;
    animation: pulse 2s infinite;
}

.definition-error .error-message {
    color: #d32f2f;
    text-align: center;
    font-size: 14px;
    background-color: #ffebee;
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid #ffcdd2;
    max-width: 90%;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.1);
    line-height: 1.5;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cache Status Indicator */
.cache-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
    animation: fadeInDown 0.3s ease-out;
    border: 1px solid;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.cache-status.cache-local {
    background-color: #e8f5e8;
    color: #2e7d32;
    border-color: #c8e6c9;
}

.cache-status.cache-server {
    background-color: #e3f2fd;
    color: #1565c0;
    border-color: #bbdefb;
}

.cache-status.cache-miss {
    background-color: #fff3e0;
    color: #ef6c00;
    border-color: #ffcc02;
}

.cache-icon {
    font-size: 14px;
    display: flex;
    align-items: center;
}

.cache-text {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Word Definition Content */
.definition-loaded .definition-content {
    padding: 0;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.word-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e8f5e8;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.word-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    text-transform: lowercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wordhippo-link {
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 0.9em;
    color: #4CAF50;
}
.wordhippo-link:hover { 
    opacity: 1; 
    text-decoration: underline;
}

.word-pronunciation {
    color: #4CAF50;
    font-style: italic;
    font-size: 18px;
    font-weight: 500;
    margin-right: 15px;
    background-color: #f0f8f0;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.word-syllables {
    color: #666;
    font-size: 14px;
    background-color: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid #e0e0e0;
}

.definitions-container {
    margin-top: 20px;
}

.part-of-speech-section {
    margin-bottom: 25px;
}

.part-of-speech-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #4CAF50;
    text-transform: capitalize;
    padding: 6px 12px;
    background-color: #e8f5e8;
    border-radius: 6px;
    display: inline-block;
    border-left: 4px solid #4CAF50;
}

.definition-item {
    margin-bottom: 18px;
    padding: 12px 0 12px 18px;
    border-left: 3px solid #e0e0e0;
    position: relative;
}

.definition-item::before {
    content: '•';
    position: absolute;
    left: -8px;
    top: 12px;
    color: #4CAF50;
    font-weight: bold;
    background-color: #fafafa;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.definition-text {
    margin: 0 0 10px 0;
    color: #333;
    line-height: 1.6;
    font-size: 15px;
}

.definition-examples {
    margin-top: 12px;
}

.example-item {
    display: block;
    color: #555;
    font-size: 13px;
    margin: 8px 0;
    padding: 10px 14px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #4CAF50;
    font-style: italic;
    position: relative;
    line-height: 1.4;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.example-item::before {
    content: '💬';
    position: absolute;
    left: -12px;
    top: 8px;
    background-color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.definition-synonyms {
    margin-top: 12px;
    font-size: 13px;
    padding: 8px 12px;
    background-color: #f0f8ff;
    border-radius: 6px;
    border: 1px solid #e0e8ff;
}

.synonyms-label {
    font-weight: 600;
    color: #4a5568;
    margin-right: 8px;
}

.synonym-item {
    color: #2d3748;
    background-color: #e2e8f0;
    padding: 3px 8px;
    border-radius: 12px;
    margin: 2px 3px;
    font-size: 12px;
    display: inline-block;
    border: 1px solid #cbd5e0;
    transition: background-color 0.2s;
}

.synonym-item:hover {
    background-color: #cbd5e0;
    cursor: pointer;
}

/* Mobile Responsive Adjustments for Definition Box */
@media (max-width: 768px) {
    .definition-box {
        border-left: none;
        border-top: 1px solid #e0e0e0;
        min-height: 250px;
    }

    .definition-content {
        padding: 12px 15px;
        font-size: 13px;
    }

    .word-header h3 {
        font-size: 18px;
    }

    .part-of-speech h4 {
        font-size: 13px;
        padding: 4px 8px;
    }

    .definition-item {
        padding-left: 12px;
        margin-bottom: 12px;
    }
}

/* Tablet Responsive Adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    .translator-box {
        grid-template-columns: 1.2fr 60px 1.2fr 250px;
    }
    
    .definition-content {
        font-size: 13px;
    }
    
    .word-header h3 {
        font-size: 18px;
    }
}
