:root {
    --primary-color: #ff6b35;
    --secondary-color: #f7931e;
    --accent-color: #1e3a8a;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --gradient-primary: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    --gradient-secondary: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 107, 53, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(247, 147, 30, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(30, 58, 138, 0.05) 0%, transparent 50%);
    z-index: -1;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.brand-icon {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 1px;
}

/* Main Content */
.main-content {
    margin-top: 70px;
}

/* Hero Section */
.hero-section {
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-content {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-title {
    margin-bottom: 1rem;
}

.title-main {
    display: block;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.title-sub {
    display: block;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 400;
    color: var(--text-light);
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* Translator Card */
.translator-card {
    background: var(--bg-white);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.card-header {
    background: var(--gradient-primary);
    padding: 1.5rem;
}

.language-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.tab.active {
    background: rgba(255, 255, 255, 0.3);
}

.tab-icon {
    font-size: 1.25rem;
}

.swap-btn {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

/* Translation Area */
.translation-area {
    padding: 2rem;
}

.input-container {
    position: relative;
    margin-bottom: 1.5rem;
}

#englishInput {
    width: 100%;
    min-height: 120px;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    background: var(--bg-light);
}

#englishInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
    background: var(--bg-white);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0 0.5rem;
}

.char-count {
    font-size: 0.875rem;
    color: var(--text-light);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

/* Translate Button */
.translate-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.translate-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.translate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.translate-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.25rem;
}

/* Output Container */
.output-container {
    position: relative;
}

.output-box {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    min-height: 120px;
    transition: all 0.3s ease;
}

.output-box.has-content {
    background: #f0f9ff;
    border-color: #0ea5e9;
    color: var(--text-dark);
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
    text-align: center;
    gap: 0.5rem;
}

.placeholder-icon {
    font-size: 2rem;
    opacity: 0.5;
}

.placeholder-text {
    font-style: italic;
}

.context-card {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 12px;
    color: #92400e;
    font-size: 0.9rem;
    display: none;
}

.context-card.show {
    display: block;
    animation: slideIn 0.3s ease;
}

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

/* Examples Section */
.examples-section {
    padding: 4rem 2rem;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.section-header p {
    font-size: 1.1rem;
    color: var(--text-light);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.example-category {
    background: var(--bg-light);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.example-category h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

.example-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.example-btn {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
}

.example-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* About Section */
.about-section {
    padding: 4rem 2rem;
    background: var(--gradient-secondary);
    color: white;
}

.about-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.about-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.features-grid {
    display: grid;
    gap: 1.5rem;
}

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

.feature-icon {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.75rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.feature h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.feature p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin: 0;
}

/* Mumbai Skyline */
.about-visual {
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.mumbai-skyline {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 200px;
}

.building {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px 4px 0 0;
    backdrop-filter: blur(10px);
    animation: buildingGlow 3s ease-in-out infinite alternate;
}

.building-1 { width: 30px; height: 120px; animation-delay: 0s; }
.building-2 { width: 40px; height: 160px; animation-delay: 0.5s; }
.building-3 { width: 35px; height: 200px; animation-delay: 1s; }
.building-4 { width: 45px; height: 140px; animation-delay: 1.5s; }
.building-5 { width: 32px; height: 100px; animation-delay: 2s; }

@keyframes buildingGlow {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 2rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content p {
    margin-bottom: 0.5rem;
}

.footer-links span {
    color: var(--secondary-color);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .translation-area {
        padding: 1.5rem;
    }
    
    .examples-section,
    .about-section {
        padding: 3rem 1rem;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .language-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .tab {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .nav-links {
        display: none;
    }
    
    .hero-content {
        margin-bottom: 2rem;
    }
    
    .translator-card {
        border-radius: 16px;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .translation-area {
        padding: 1rem;
    }
}
/* API Configuration Modal */
.api-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    padding: 1rem;
}

.api-modal-content {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    position: relative;
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.modal-subtitle {
    color: var(--text-light);
    font-size: 1rem;
    margin: 0;
}

.modal-body p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

#apiKeyInput {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

#apiKeyInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.api-modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.api-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.api-btn.primary {
    background: var(--gradient-primary);
    color: white;
}

.api-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.api-btn.secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.api-btn.secondary:hover {
    background: var(--border-color);
}

.api-info {
    text-align: left;
    background: var(--bg-light);
    border-radius: 12px;
    padding: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.info-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.info-item a:hover {
    text-decoration: underline;
}

/* Modal open state */
body.modal-open {
    overflow: hidden;
}

/* Settings Button */
.settings-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.settings-btn:hover {
    background: var(--bg-light);
    transform: rotate(90deg);
}

/* Message Toast */
.message-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 300px;
    box-shadow: var(--shadow-lg);
}

.message-toast.show {
    transform: translateX(0);
}

.message-toast.success {
    background: #10b981;
}

.message-toast.warning {
    background: #f59e0b;
}

.message-toast.info {
    background: #3b82f6;
}

.message-toast.error {
    background: #ef4444;
}

/* Enhanced Context Card */
.context-card {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    color: #92400e;
    font-size: 0.9rem;
    display: none;
    position: relative;
}

.context-card::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #f59e0b;
}

.context-card.show {
    display: block;
    animation: slideInUp 0.3s ease;
}

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

/* Enhanced Output Box */
.output-box.has-content {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #0ea5e9;
    color: var(--text-dark);
    position: relative;
}

.output-box.has-content::before {
    content: '✨';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.2rem;
    opacity: 0.7;
}

/* Loading Animation Enhancement */
.placeholder-icon {
    animation: pulse 2s infinite;
}

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

/* Mobile Responsiveness for Modal */
@media (max-width: 768px) {
    .api-modal {
        padding: 0.5rem;
        align-items: flex-start;
        padding-top: 2rem;
    }
    
    .api-modal-content {
        padding: 1.5rem;
        margin: 0;
        border-radius: 16px;
        max-height: calc(100vh - 4rem);
    }
    
    .modal-header h3 {
        font-size: 1.25rem;
    }
    
    .api-modal-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .api-btn {
        width: 100%;
        min-width: auto;
    }
    
    #apiKeyInput {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .info-item {
        font-size: 0.8rem;
    }
    
    .message-toast {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .message-toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .nav-link {
        font-size: 0.9rem;
    }
    
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .title-main {
        font-size: 2rem;
    }
    
    .title-sub {
        font-size: 1.25rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .translation-area {
        padding: 1rem;
    }
    
    .translator-card {
        border-radius: 16px;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .language-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .tab {
        width: 100%;
        justify-content: center;
    }
    
    .examples-section,
    .about-section {
        padding: 3rem 1rem;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .api-modal-content {
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-subtitle {
        font-size: 0.9rem;
    }
    
    .api-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* Enhanced Navbar for Settings */
.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* Improved Button States */
.translate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.translate-btn:disabled:hover {
    transform: none !important;
    box-shadow: var(--shadow-md) !important;
}

/* Source Indicator Styles */
.context-card[data-source="cohere"] {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #0ea5e9;
    color: #0c4a6e;
}

.context-card[data-source="local"] {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    border-color: #a855f7;
    color: #581c87;
}

.context-card[data-source="fallback"] {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    color: #92400e;
}