/* Reset and Base Styles */
* {
    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;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 40px;
    width: auto;
}

.header h1 {
    font-size: 1.5rem;
    color: #667eea;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-icon {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.btn-danger {
    background: #ff4757;
    color: white;
}

.btn-danger:hover {
    background: #ee5a6f;
    transform: translateY(-2px);
}

.btn-icon {
    background: transparent;
    font-size: 1.5rem;
    padding: 0.5rem;
}

.btn-icon:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Upload Section */
.upload-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.upload-card {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-card h2 {
    color: #333;
    margin-bottom: 0.5rem;
}

.upload-description {
    color: #666;
    margin-bottom: 2rem;
}

.language-selector {
    margin-bottom: 2rem;
}

.language-selector label {
    display: block;
    margin-bottom: 1rem;
    color: #666;
    font-weight: 500;
}

.language-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.lang-btn {
    padding: 0.8rem 1.5rem;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.lang-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.upload-area {
    border: 3px dashed #d0d0d0;
    border-radius: 12px;
    padding: 3rem;
    margin: 2rem 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-prompt p {
    color: #666;
    margin-bottom: 1rem;
}

.upload-progress {
    margin-top: 2rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    width: 0%;
}

#progressText {
    color: #666;
    font-size: 0.9rem;
}

/* My Texts Section */
.my-texts-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.my-texts-section h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.texts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.text-item {
    background: #f8f9ff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.text-item:hover {
    border-color: #667eea;
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.text-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.text-item-title {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-item-lang {
    font-size: 1.2rem;
}

.text-item-info {
    color: #666;
    font-size: 0.85rem;
}

.loading-text {
    text-align: center;
    color: #999;
    padding: 2rem;
}

/* Analysis Section */
.analysis-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.analysis-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.analysis-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    min-height: 600px;
}

/* Text Panel */
.text-panel, .analysis-panel {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 1.1rem;
}

.sentence-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.text-content, .analysis-content-area {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    background: white;
}

.sentence {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.6;
}

.sentence:hover {
    background: #f8f9ff;
}

.sentence.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left: 4px solid #667eea;
    padding-left: 1rem;
}

/* Analysis Content */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 1.1rem;
    flex-direction: column;
}

.analysis-result {
    animation: fadeIn 0.5s ease;
}

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

.analysis-section-title {
    color: #667eea;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.8rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.analysis-section-title:first-child {
    margin-top: 0;
}

.translation-text {
    background: #f8f9ff;
    padding: 1rem;
    border-radius: 8px;
    line-height: 1.6;
    color: #333;
    border-left: 4px solid #667eea;
}

.vocab-list {
    list-style: none;
}

.vocab-item {
    background: #f8f9ff;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    border-left: 3px solid #764ba2;
}

.vocab-word {
    font-weight: 600;
    color: #667eea;
    font-size: 1.05rem;
}

.vocab-explanation {
    color: #666;
    margin-top: 0.3rem;
    line-height: 1.5;
}

.grammar-text {
    background: #fff9f0;
    padding: 1rem;
    border-radius: 8px;
    line-height: 1.6;
    color: #333;
    border-left: 4px solid #ffa502;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: white;
    margin-top: 1rem;
    font-size: 1.1rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #333;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #2ecc71;
}

.toast.error {
    background: #e74c3c;
}

/* Responsive Design */
@media (max-width: 968px) {
    .analysis-content {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .analysis-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }
    
    .upload-card {
        padding: 2rem 1rem;
    }
    
    .language-buttons {
        flex-direction: column;
    }
    
    .texts-list {
        grid-template-columns: 1fr;
    }
}

/* ===== 咖啡加载动画 ===== */
.coffee-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 60px 20px;
    gap: 20px;
}

.coffee-cup {
    position: relative;
    width: 80px;
    height: 60px;
}

.cup {
    width: 80px;
    height: 50px;
    background: linear-gradient(to bottom, #8B4513 0%, #A0522D 100%);
    border-radius: 0 0 40px 40px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.cup::before {
    content: '';
    position: absolute;
    width: 70px;
    height: 5px;
    background: #6B3410;
    top: 8px;
    left: 5px;
    border-radius: 50%;
}

.cup-handle {
    position: absolute;
    width: 25px;
    height: 35px;
    border: 4px solid #8B4513;
    border-left: none;
    border-radius: 0 15px 15px 0;
    right: -20px;
    top: 10px;
}

.steam {
    position: absolute;
    width: 100%;
    height: 40px;
    top: -40px;
    left: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.steam-line {
    width: 3px;
    height: 35px;
    background: linear-gradient(to top, rgba(139, 69, 19, 0.6), rgba(160, 82, 45, 0.3), transparent);
    border-radius: 50%;
    animation: steam-rise 2s ease-in-out infinite;
}

.steam-line:nth-child(1) {
    animation-delay: 0s;
}

.steam-line:nth-child(2) {
    animation-delay: 0.3s;
}

.steam-line:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes steam-rise {
    0% {
        transform: translateY(0) scaleX(1);
        opacity: 0;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-20px) scaleX(1.5);
        opacity: 0;
    }
}

.coffee-text {
    font-size: 18px;
    color: #666;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.coffee-subtext {
    font-size: 14px;
    color: #999;
    margin-top: -10px;
}
