:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #06b6d4;
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-main: #1e293b;
    --text-muted: #64748b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f3e8ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

.navbar {
    padding: 1.5rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.7rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

.login-btn {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary) !important;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
}

.login-btn:hover {
    background: rgba(139, 92, 246, 0.2);
}

.container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    margin-bottom: 5rem;
}

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

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.6;
}

.upload-card,
.processing-card,
.result-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.upload-card.dragover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.02);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15);
}

.upload-card input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 3.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.upload-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.upload-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.browse-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.browse-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(139, 92, 246, 0.4);
}

.supported-formats {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.supported-formats span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.hidden {
    display: none !important;
}

.ai-sparkle {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Loading Phase Tips */
.tips-container {
    margin: 0 auto 1.5rem;
    max-width: 700px;
    padding: 2rem 2.5rem;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.tips-intro {
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 800;
}

.tip-spacer {
    height: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px dashed #cbd5e1;
}

#study-tip {
    font-size: 1.25rem;
    color: #1e293b;
    margin: 0;
    line-height: 1.6;
    font-weight: 500;
    transition: opacity 0.5s ease;
    min-height: 4.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 14px;
    background: #e2e8f0;
    border-radius: 10px;
    margin: 2rem 0;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.result-card {
    padding: 2.5rem;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.success-icon {
    color: #10b981;
}

.summary-box {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2rem;
    text-align: left;
    height: 350px;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.7;
    color: #334155;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.02);
    margin-bottom: 2rem;
}

.summary-box h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    margin-top: 2.5rem;
    font-size: 1.25rem;
}

.summary-box h4:first-child {
    margin-top: 0;
}

.summary-box ul {
    margin-left: 1.5rem;
    margin-bottom: 2rem;
}

.summary-box p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.summary-box li {
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

/* Colored Text Classes for AI Generation */
.yellow-highlight {
    display: inline-block;
    background-color: #fef08a;
    color: #854d0e;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    font-weight: 700;
}

.green-highlight {
    display: inline-block;
    background-color: #bbf7d0;
    color: #166534;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    font-weight: 700;
}

.pink-highlight {
    display: inline-block;
    background-color: #fbcfe8;
    color: #831843;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    font-weight: 700;
}

.highlight-text {
    color: var(--primary);
    font-weight: 700;
}

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

.action-buttons button {
    border: none;
    padding: 0.8rem 1.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1 !important;
}

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

.download-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.reset-btn {
    background: white;
    color: var(--text-main);
    border: 1px solid #e2e8f0 !important;
}

.reset-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1 !important;
    transform: translateY(-2px);
}

/* Quiz Styles */
.quiz-list {
    margin-left: 0 !important;
    list-style-type: none !important;
}

.quiz-list>li {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    page-break-inside: avoid;
    break-inside: avoid;
}

.quiz-list>li>p:first-child {
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 1rem;
}

.quiz-list ul {
    margin-left: 1rem !important;
    margin-bottom: 1.5rem !important;
    list-style-type: disc !important;
    color: #475569;
}

.show-answer-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

.show-answer-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

.show-answer-btn.active {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.hidden-answer {
    margin-top: 1rem;
    padding: 1rem;
    background: #ecfdf5;
    border-left: 4px solid #10b981;
    border-radius: 0 8px 8px 0;
}

/* Detail Slider Setting Styles */
.settings-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(241, 245, 249, 0.7);
    border: 1px dashed rgba(100, 116, 139, 0.4);
    border-radius: 12px;
    text-align: left;
}

.settings-container label {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
    text-align: center;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    font-size: 0.95rem;
    color: #475569;
    font-weight: 700;
}

.custom-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 10px;
    background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
    border-radius: 5px;
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.5);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: var(--secondary);
}

/* Footer Disclaimer */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
    font-size: 0.85rem;
    color: #64748b;
    background: transparent;
}

.site-footer i {
    color: #f59e0b;
}

/* Success Graph Section */
.success-graph-section {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 0.5rem;
    padding: 0;
    text-align: center;
}

.success-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: nowrap;
    /* Force 1 line */
}

.step-card {
    flex: 1 1 0;
    /* Equal width for all 3 cards */
    min-width: 0;
    /* Let flex shrink to fit if needed */
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.step-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.1);
}

.highlight-step {
    background: #ffffff;
    border: 3px solid transparent;
    background-image: linear-gradient(white, white), linear-gradient(135deg, var(--primary), var(--secondary));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(139, 92, 246, 0.2);
}

.highlight-step:hover {
    transform: scale(1.05) translateY(-8px);
}

.step-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #64748b;
}

.highlight-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.step-card h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.step-card p {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.4;
    margin: 0;
}

.step-arrow {
    font-size: 1.5rem;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.step-arrow i {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Responsive adjustments for the graph */
@media (max-width: 768px) {
    .success-steps {
        flex-direction: column;
        gap: 1rem;
    }

    .step-arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }

    .highlight-step {
        transform: scale(1);
        /* remove scale up on mobile */
    }

    .highlight-step:hover {
        transform: translateY(-5px);
    }

    .step-card {
        width: 100%;
    }
}

/* PDF Printing Utilities */
.pdf-page-break-before {
    page-break-before: always !important;
    break-before: page !important;
}

.pdf-page-break-after {
    page-break-after: always !important;
    break-after: page !important;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: white;
    padding: 3rem 2.5rem;
    border-radius: 24px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #64748b;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-modal:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: rotate(90deg);
}

.modal-header h2 {
    font-size: 1.8rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.modal-header p {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.signup-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.auth-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.2);
    width: 100%;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(139, 92, 246, 0.3);
}

.modal-footer {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Password field with eye-toggle */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 3rem !important;
}

.eye-toggle {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.eye-toggle:hover {
    color: var(--primary);
}

/* -------------------------------------------
   Mobile Responsive Adjustments
------------------------------------------- */
@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Container & Typography */
    .container {
        padding: 1rem;
        margin-top: 1rem;
    }
    .hero h1 {
        font-size: 2rem;
    }
    #main-desc {
        font-size: 0.95rem;
        padding: 0 1rem;
    }

    /* Cards */
    .upload-card, 
    .processing-card, 
    .result-card,
    .tips-container {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }

    /* File Upload Area */
    .supported-formats {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .supported-formats span {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    /* Slider Settings */
    .slider-wrapper {
        flex-direction: row;
        gap: 0.5rem;
    }
    .slider-wrapper span {
        font-size: 0.8rem;
    }
    .custom-slider {
        width: 100%;
    }

    /* Action Buttons */
    .action-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    .action-buttons button {
        width: 100%;
        margin-left: 0;
    }

    /* Summary & Quiz Output */
    .summary-box {
        padding: 1.5rem 1rem;
    }
    .show-answer-btn {
        width: 100%;
        justify-content: center;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    .hidden-answer {
        border-radius: 8px;
        border-left: none;
        border-top: 4px solid #10b981;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        padding: 2rem 1.5rem;
    }
}