@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-light: 0 8px 32px rgba(31, 38, 135, 0.37);
    --shadow-heavy: 0 15px 35px rgba(31, 38, 135, 0.5);
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-light: #718096;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 8s;
}

.particle:nth-child(2) {
    left: 20%;
    animation-delay: 1s;
    animation-duration: 6s;
}

.particle:nth-child(3) {
    left: 60%;
    animation-delay: 2s;
    animation-duration: 10s;
}

.particle:nth-child(4) {
    left: 80%;
    animation-delay: 3s;
    animation-duration: 7s;
}

.particle:nth-child(5) {
    left: 90%;
    animation-delay: 4s;
    animation-duration: 9s;
}

.particle:nth-child(6) {
    left: 40%;
    animation-delay: 5s;
    animation-duration: 8s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10%,
    90% {
        opacity: 1;
    }

    50% {
        transform: translateY(-10vh) rotate(180deg);
        opacity: 0.8;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 50px;
    color: white;
    position: relative;
    padding: 40px 0;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 0.5;
    }

    50% {
        transform: translateX(-50%) scale(1.1);
        opacity: 0.8;
    }
}

header h1 {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f8ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: -2px;
    animation: slideInDown 1s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

header p {
    font-size: 1.4rem;
    font-weight: 400;
    opacity: 0.95;
    margin-bottom: 20px;
    animation: slideInUp 1s ease-out 0.3s both;
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.header-badge {
    display: inline-block;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 10px;
    animation: slideInUp 1s ease-out 0.6s both;
}

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    background: var(--glass-bg);
    border-radius: 20px;
    padding: 8px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-light);
    animation: slideInUp 1s ease-out 0.9s both;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 18px 30px;
    color: white;
    cursor: pointer;
    border-radius: 15px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    min-width: 160px;
}

.tab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.tab-button:hover::before {
    left: 100%;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.tab-button.active {
    background: white;
    color: #667eea;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
}

.tab-button.active::before {
    display: none;
}

.tab-content {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 50px;
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.tab-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.tab-content.active {
    display: block;
    animation: fadeInScale 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tab-content h2 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.tab-content p {
    color: var(--text-secondary);
    margin-bottom: 35px;
    font-size: 1.2rem;
    line-height: 1.6;
    font-weight: 400;
}

.input-section {
    margin-bottom: 30px;
}

.upload-section {
    margin-bottom: 30px;
    text-align: center;
}

textarea {
    width: 100%;
    min-height: 140px;
    padding: 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.95);
}

textarea::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

.primary-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
    min-width: 180px;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.primary-btn:hover::before {
    left: 100%;
}

.primary-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.primary-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #667eea;
    border: 2px solid rgba(102, 126, 234, 0.3);
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.secondary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    transition: left 0.4s ease;
    z-index: -1;
}

.secondary-btn:hover::before {
    left: 0;
}

.secondary-btn:hover {
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.file-label {
    display: inline-block;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 3px dashed rgba(102, 126, 234, 0.4);
    padding: 40px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.2rem;
    color: #667eea;
    font-weight: 600;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-width: 300px;
}

.file-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.6s;
}

.file-label:hover::before {
    left: 100%;
}

.file-label:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.3);
}

.file-label.file-selected {
    background: var(--success-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}

input[type="file"] {
    display: none;
}

.result-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    margin-top: 40px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
    animation: slideInUp 0.6s ease-out;
}

.result-section h3 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 25px;
    font-size: 1.8rem;
    font-weight: 700;
}

.formula-box {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    color: #68d391;
    padding: 25px;
    border-radius: 15px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 1.3rem;
    margin-bottom: 25px;
    position: relative;
    overflow-x: auto;
    border: 1px solid rgba(104, 211, 145, 0.2);
    box-shadow: 0 8px 25px rgba(26, 32, 44, 0.3);
}

.formula-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #68d391, #4fd1c7, #63b3ed);
}

.copy-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--success-gradient);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.5);
}

.explanation,
.example,
.details {
    margin-top: 20px;
}

.explanation h4,
.example h4,
.details h4 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.answer-box,
.summary-box {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    backdrop-filter: blur(15px);
    border-left: 5px solid transparent;
    border-image: var(--primary-gradient) 1;
    padding: 25px;
    border-radius: 0 15px 15px 0;
    margin-bottom: 25px;
    font-size: 1.2rem;
    line-height: 1.7;
    box-shadow: 0 8px 25px rgba(31, 38, 135, 0.1);
    position: relative;
    overflow: hidden;
}

.answer-box::before,
.summary-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--primary-gradient);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.insight-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.insight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.insight-card:nth-child(2)::before {
    background: var(--secondary-gradient);
}

.insight-card:nth-child(3)::before {
    background: var(--warning-gradient);
}

.insight-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 45px rgba(31, 38, 135, 0.25);
}

.insight-card h3 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 700;
}

.insight-card:nth-child(2) h3 {
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.insight-card:nth-child(3) h3 {
    background: var(--warning-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.insight-card ul {
    list-style: none;
}

.insight-card li {
    padding: 15px 0;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    line-height: 1.6;
    color: var(--text-secondary);
    font-weight: 400;
    position: relative;
    padding-left: 25px;
}

.insight-card li:last-child {
    border-bottom: none;
}

.insight-card li:before {
    content: "✨";
    position: absolute;
    left: 0;
    top: 15px;
    font-size: 1.1rem;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 25px;
    position: relative;
}

.spinner::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 4px solid transparent;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1.5s linear infinite reverse;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading p {
    font-size: 1.2rem;
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

.error-message {
    position: fixed;
    top: 30px;
    right: 30px;
    background: linear-gradient(135deg, #e53e3e 0%, #ff6b6b 100%);
    backdrop-filter: blur(15px);
    color: white;
    padding: 20px 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(229, 62, 62, 0.4);
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 450px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.error-message button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.error-message button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.suggestions-section {
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
}

.suggestions-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.suggestions-section h4 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.suggestion-chip {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(102, 126, 234, 0.2);
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #667eea;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.suggestion-chip::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    transition: left 0.4s ease;
    z-index: -1;
}

.suggestion-chip:hover::before {
    left: 0;
}

.suggestion-chip:hover {
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .tabs {
        flex-direction: column;
        gap: 5px;
    }

    .tab-content {
        padding: 20px;
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }

    .suggestion-chips {
        flex-direction: column;
    }

    .suggestion-chip {
        white-space: normal;
        text-align: left;
    }
}