Spaces:
Running
Running
Masfiq Mahmud
Add sentiment analysis feature using Gemini API and update UI for sentiment display
ea78f87
| :root { | |
| --primary-color: #2962ff; | |
| --secondary-color: #f8fafe; | |
| --text-color: #1a1f36; | |
| --border-color: #e1e6ef; | |
| --hover-color: #edf2ff; | |
| --shadow-color: rgba(0, 0, 0, 0.06); | |
| } | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Google Sans', 'Roboto', sans-serif; | |
| background: #fff; | |
| color: var(--text-color); | |
| min-height: 100vh; | |
| } | |
| .page-container { | |
| min-height: 100vh; | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| padding: 40px 20px; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| } | |
| .container { | |
| max-width: 800px; | |
| width: 100%; | |
| background: white; | |
| border-radius: 20px; | |
| padding: 30px; | |
| box-shadow: 0 10px 30px var(--shadow-color); | |
| } | |
| header { | |
| text-align: center; | |
| margin-bottom: 20px; | |
| } | |
| h1 { | |
| font-size: 2.5em; | |
| font-weight: 600; | |
| background: linear-gradient(135deg, var(--primary-color), #1e88e5); | |
| -webkit-background-clip: text; | |
| background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| margin-bottom: 10px; | |
| } | |
| .subtitle { | |
| color: #666; | |
| font-size: 1.1em; | |
| } | |
| .translation-box { | |
| background: white; | |
| border-radius: 16px; | |
| box-shadow: 0 8px 30px var(--shadow-color); | |
| width: 100%; | |
| max-width: 900px; | |
| margin-top: 30px; | |
| overflow: hidden; | |
| border: 1px solid var(--border-color); | |
| } | |
| .input-section, .output-section { | |
| padding: 30px; | |
| } | |
| .input-section { | |
| background: var(--secondary-color); | |
| border-bottom: 1px solid var(--border-color); | |
| } | |
| .input-header, .output-header { | |
| margin-bottom: 15px; | |
| } | |
| label { | |
| font-weight: 500; | |
| color: var(--text-color); | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| } | |
| .char-count { | |
| color: #5f6368; | |
| font-size: 0.8em; | |
| } | |
| textarea { | |
| width: 100%; | |
| min-height: 160px; | |
| padding: 15px; | |
| border: 1px solid var(--border-color); | |
| border-radius: 12px; | |
| background: white; | |
| font-size: 1.1em; | |
| line-height: 1.5; | |
| transition: border-color 0.3s ease; | |
| } | |
| textarea:focus { | |
| outline: none; | |
| border-color: var(--primary-color); | |
| box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.1); | |
| } | |
| .controls { | |
| padding: 15px 30px; | |
| background: white; | |
| border-top: 1px solid var(--border-color); | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .primary-btn, .secondary-btn, .icon-btn { | |
| padding: 12px 25px; | |
| border: none; | |
| border-radius: 8px; | |
| cursor: pointer; | |
| font-size: 1em; | |
| font-weight: 500; | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| transition: all 0.3s ease; | |
| } | |
| .primary-btn { | |
| background: var(--primary-color); | |
| color: white; | |
| padding: 12px 32px; | |
| border-radius: 8px; | |
| font-size: 1rem; | |
| font-weight: 500; | |
| letter-spacing: 0.3px; | |
| transition: transform 0.2s ease, background 0.2s ease; | |
| } | |
| .primary-btn:hover { | |
| background: #1e4bd8; | |
| transform: translateY(-1px); | |
| } | |
| .secondary-btn { | |
| background: #e0e0e0; | |
| color: #666; | |
| } | |
| .secondary-btn:hover { | |
| background: #d0d0d0; | |
| } | |
| .icon-btn { | |
| width: 40px; | |
| height: 40px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| border-radius: 10px; | |
| transition: all 0.2s ease; | |
| } | |
| .icon-btn:hover { | |
| background: var(--hover-color); | |
| transform: scale(1.05); | |
| } | |
| .translation-result { | |
| min-height: 120px; | |
| background: white; | |
| border-radius: 12px; | |
| padding: 20px; | |
| font-size: 1.1em; | |
| line-height: 1.6; | |
| } | |
| /* Sentiment Badge Styles */ | |
| #sentimentContainer { | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| font-size: 1em; | |
| color: var(--text-color); | |
| } | |
| .sentiment-badge { | |
| display: inline-block; | |
| padding: 4px 12px; | |
| border-radius: 16px; | |
| font-size: 0.9em; | |
| font-weight: 500; | |
| color: white; | |
| text-transform: capitalize; | |
| } | |
| .sentiment-positive { | |
| background-color: #2e7d32; | |
| } | |
| .sentiment-negative { | |
| background-color: #c62828; | |
| } | |
| .sentiment-neutral { | |
| background-color: #616161; | |
| } | |
| /* Loading Spinner */ | |
| .loading-spinner { | |
| display: flex; | |
| justify-content: center; | |
| padding: 30px; | |
| } | |
| .spinner { | |
| width: 30px; | |
| height: 30px; | |
| border: 3px solid var(--secondary-color); | |
| border-top: 3px solid var(--primary-color); | |
| border-radius: 50%; | |
| animation: spin 1s linear infinite; | |
| } | |
| /* Toast Notification */ | |
| .toast { | |
| position: fixed; | |
| bottom: 24px; | |
| left: 50%; | |
| transform: translateX(-50%); | |
| background: #323232; | |
| color: white; | |
| padding: 12px 30px; | |
| border-radius: 8px; | |
| font-size: 0.95rem; | |
| box-shadow: 0 2px 5px rgba(0,0,0,0.2); | |
| animation: slideUp 0.3s ease; | |
| } | |
| /* Animations */ | |
| @keyframes spin { | |
| 0% { transform: rotate(0deg); } | |
| 100% { transform: rotate(360deg); } | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translate(-50%, 20px); } | |
| to { opacity: 1; transform: translate(-50%, 0); } | |
| } | |
| @keyframes fadeOut { | |
| from { opacity: 1; transform: translate(-50%, 0); } | |
| to { opacity: 0; transform: translate(-50%, 20px); } | |
| } | |
| @keyframes slideUp { | |
| from { transform: translate(-50%, 100%); opacity: 0; } | |
| to { transform: translate(-50%, 0); opacity: 1; } | |
| } | |
| /* Responsive Design */ | |
| @media (max-width: 768px) { | |
| .page-container { | |
| padding: 20px 15px; | |
| } | |
| .translation-box { | |
| border-radius: 12px; | |
| border-left: none; | |
| border-right: none; | |
| } | |
| .container { | |
| padding: 20px; | |
| margin: 10px; | |
| } | |
| h1 { | |
| font-size: 2em; | |
| } | |
| .input-section, .output-section { | |
| padding: 20px; | |
| } | |
| .controls { | |
| flex-direction: column; | |
| padding: 15px 20px; | |
| } | |
| .primary-btn, .secondary-btn { | |
| width: 100%; | |
| justify-content: center; | |
| } | |
| } | |