:root {
    --jupiter-blue: #4A90E2;
    --jupiter-dark: #0F1A2A;
    --jupiter-darker: #0A121F;
    --jupiter-glow: rgba(74, 144, 226, 0.3);
    --text-light: #E8F0FE;
    --text-muted: #A0AEC0;
    --card-bg: rgba(15, 26, 42, 0.7);
    --success: #48BB78;
    --warning: #ED8936;
    --danger: #F56565;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--jupiter-darker), var(--jupiter-dark));
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.6;
}

/* General Button Styles (from app.html, useful globally) */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--jupiter-blue), #357ABD);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Landing Page (index.html) Styles */
.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.landing-header .logo {
    justify-content: flex-start;
}

.landing-main {
    text-align: center;
    padding: 60px 0;
}

.hero-title {
    font-family: 'Poppins', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 40px;
}

.features {
    display: flex;
    justify-content: space-around;
    gap: 30px;
    margin-top: 80px;
}

.feature-item {
    max-width: 300px;
}
.feature-item h3 {
    margin-bottom: 10px;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.app-header { /* Renamed to avoid conflict */
    margin-bottom: 30px;
    padding: 20px;
    border-bottom: 1px solid rgba(74, 144, 226, 0.2);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 2.5rem;
    color: var(--jupiter-blue);
    text-shadow: 0 0 15px var(--jupiter-glow);
}

.logo-img {
    width: 40px;
    height: 40px;
}

.logo-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 2.2rem;
    background: linear-gradient(to right, var(--jupiter-blue), #63B3ED);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.tagline {
    font-size: 1.1rem;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Auth Page (auth.html) Styles */
.auth-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-header {
    position: absolute;
    top: 20px;
    left: 20px;
}

.auth-header .logo {
    text-decoration: none;
}

.auth-form-container {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(74, 144, 226, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
}

.auth-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(10, 18, 31, 0.7);
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 10px;
    color: var(--text-light);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--jupiter-blue);
    box-shadow: 0 0 0 2px var(--jupiter-glow);
}

.auth-btn {
    width: 100%;
    margin-top: 10px;
}

/* Input Section */
.input-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(74, 144, 226, 0.1);
    backdrop-filter: blur(10px);
}

.input-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab.active {
    color: var(--jupiter-blue);
    border-bottom: 3px solid var(--jupiter-blue);
}

.tab:hover:not(.active) {
    color: var(--text-muted);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.text-input {
    width: 100%;
    min-height: 120px;
    background: rgba(10, 18, 31, 0.7);
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 12px;
    padding: 15px;
    color: var(--text-light);
    font-size: 16px;
    resize: vertical;
    font-family: 'Inter', sans-serif;
}

.text-input:focus {
    outline: none;
    border-color: var(--jupiter-blue);
    box-shadow: 0 0 0 2px var(--jupiter-glow);
}

.voice-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.voice-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--jupiter-blue), #357ABD);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(74, 144, 226, 0.4);
    border: none;
}

.voice-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(74, 144, 226, 0.6);
}

.voice-btn.listening {
    background: linear-gradient(135deg, var(--warning), #C05621);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(237, 137, 54, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(237, 137, 54, 0); }
    100% { box-shadow: 0 0 0 0 rgba(237, 137, 54, 0); }
}

.image-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.upload-area {
    width: 100%;
    height: 200px;
    border: 2px dashed rgba(74, 144, 226, 0.4);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--jupiter-blue);
    background: rgba(74, 144, 226, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: var(--jupiter-blue);
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.upload-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    display: none;
}

.ocr-status {
    padding: 10px;
    border-radius: 8px;
    background: rgba(74, 144, 226, 0.1);
    color: var(--jupiter-blue);
    display: none;
}

.action-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 15px;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Solution Section */
.solution-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(74, 144, 226, 0.1);
    backdrop-filter: blur(10px);
    display: none;
}

.solution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.solution-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--jupiter-blue);
}

.solution-actions {
    display: flex;
    gap: 10px;
}

.solution-content {
    margin-bottom: 20px;
}

.step {
    position: relative;
    padding: 15px 15px 15px 40px;
    margin-bottom: 20px;
    border-left: 2px solid var(--jupiter-blue);
}

.step::before {
    content: attr(data-step);
    position: absolute;
    left: -15px;
    top: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--jupiter-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.step-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-light);
}

.step-content {
    line-height: 1.8;
    color: var(--text-muted);
}

.final-answer {
    border-left: 2px solid var(--success);
}

/* History Section */
.history-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(74, 144, 226, 0.1);
    backdrop-filter: blur(10px);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--jupiter-blue);
}

.history-actions {
    display: flex;
    gap: 10px;
}

.search-container {
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(10, 18, 31, 0.7);
    border: 1px solid rgba(74, 144, 226, 0.2);
    border-radius: 10px;
    color: var(--text-light);
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--jupiter-blue);
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    background: rgba(10, 18, 31, 0.5);
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.history-item:hover {
    background: rgba(10, 18, 31, 0.7);
    border-left: 4px solid var(--jupiter-blue);
}

.history-question {
    font-weight: 500;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-answer-preview {
    font-size: 0.9rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Auth Page Specifics */
.auth-switch {
    margin-top: 25px;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--jupiter-blue);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

#signup-form {
    display: none;
}


/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid rgba(74, 144, 226, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }
    
    .logo-text, .hero-title {
        font-size: 1.8rem;
    }
    
    .input-section, .solution-section, .history-section {
        padding: 20px;
    }
    
    .action-buttons, .features {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .solution-header, .history-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .solution-actions, .history-actions {
        width: 100%;
        justify-content: space-between;
    }

    .auth-header {
        position: static;
        margin-bottom: 30px;
    }
}

/* MathJax styling */
.math-display {
    padding: 10px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow-x: auto;
}

/* PWA Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(74, 144, 226, 0.2);
    backdrop-filter: blur(10px);
    display: none;
    z-index: 1000;
    max-width: 300px;
}

.install-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.install-title {
    font-weight: 600;
    color: var(--jupiter-blue);
}

.install-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
}

.install-body {
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.install-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 18, 31, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 2000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(74, 144, 226, 0.3);
    border-left: 4px solid var(--jupiter-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--warning);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
    z-index: 1500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Error Message */
.error-message {
    background: rgba(245, 101, 101, 0.1);
    border-left: 4px solid var(--danger);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    color: var(--danger);
}