:root {
    --bg-color-dark: #121212;
    --bg-color-light: #ffffff;
    --question-bg-dark: #2a2a2a;
    --question-bg-light: #f0f0f0;
    --answer-bg-dark: #1c1c1c;
    --answer-bg-light: #ffffff;
    --text-color-dark: #f5f5f5;
    --text-color-light: #000000;
    --accent-color: #bb86fc;
    --border-color-dark: #333;
    --border-color-light: #ccc;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto,
                    "Helvetica Neue", Arial, sans-serif;
}

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

body {
    background-color: var(--bg-color-dark);
    color: var(--text-color-dark);
    font-family: var(--font-family);
    font-size: 1rem; 
    line-height: 1.6;
    padding: 2rem;
    transition: background-color 0.3s, color 0.3s;
}

body.light-mode {
    background-color: var(--bg-color-light);
    color: var(--text-color-light);
}

h1 {
    font-size: 2.2rem;
    line-height: 1.3;
}

.question,
.answer {
    font-size: 1rem;
    line-height: 1.7;
    text-align: justify;
    text-align-last: left
}

.question p,
.answer p {
    margin-bottom: 1.2rem;
}

code, .token {
    font-family: "SF Mono", "Menlo", "Consolas", "Courier New", monospace;
    background: rgba(255,255,255,0.08);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

body.light-mode code {
    background: rgba(0,0,0,0.08);
}

.close-button {
    font-size: 1.05rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
    background-color: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    text-align: center;
    position: relative;
}

/* Light mode container */
body.light-mode .container {
    background-color: #ffffff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--accent-color);
    z-index: 10;
}

body.light-mode .theme-toggle {
    color: var(--text-color-light);
}

/* Fixed Header Start */

.fixed-header {
    position: sticky;
    top: 0;
    background-color: #1a1a1a;
    padding: 1rem;
    border-radius: 12px;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

body.light-mode .fixed-header {
    background-color: #ffffff;
}

/* Scrollable Content */
.scrollable-content {
    margin-top: 0;
    padding-top: 1rem;
}

/* Fixed Header End */

.user-header {
    text-align: center;
    margin-bottom: 2rem;
}

.user-header h1 {
    margin-bottom: 1rem;
    color: var(--text-color-dark);
}

body.light-mode .user-header h1 {
    color: var(--text-color-light);
}

.user-info {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: #aaa;
}

.user-info .editable {
    color: var(--text-color-dark);
    font-weight: 500;
}

body.light-mode .user-info .editable {
    color: var(--text-color-light);
}

.email-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.email-link:hover {
    text-decoration: underline;
}

.qa-pair {
    margin-bottom: 1.5rem;
}

/* Question styling with proper icon spacing */
.question {
    background: var(--question-bg-dark);
    padding: 1.5rem 1.75rem 1.5rem 3rem;
    border-radius: 8px;
    border: 1px dashed #555;
    margin-bottom: 0.75rem;
    position: relative;
    font-style: italic;
    color: #ccc;
}

body.light-mode .question {
    background: var(--question-bg-light);
    border-color: var(--border-color-light);
    color: var(--text-color-light);
}

/* Question icon positioning */
.question .icon {
    position: absolute;
    top: 0.75rem;  /* Moved down slightly */
    left: 0.75rem;
    font-size: 1.4rem;
    color: #ccc;
}

body.light-mode .question .icon {
    color: var(--text-color-light);
}

/* Answer styling with proper icon spacing */
.answer {
    background: var(--answer-bg-dark);
    padding: 1.5rem 1.75rem 1.5rem 3rem; /* Added more left padding: 3rem */
    border-radius: 8px;
    border: 1px solid var(--border-color-dark);
    position: relative;
    font-style: normal;
    color: var(--text-color-dark);
}

body.light-mode .answer {
    background: var(--answer-bg-light);
    border-color: var(--border-color-light);
    color: var(--text-color-light);
}

/*  Answer icon positioning */
.answer .icon {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem; 
    font-size: 1.4rem;
    color: var(--accent-color);
}

.downloads {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.download-btn.pdf {
    background-color: #1e88e5ce;
    color: white;
}

.download-btn.json {
    background-color: #6200ea9d;
    color: white;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.download-btn i {
    font-size: 1.25rem;
}

/* Image Answer */

.image-answer {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
    padding: 1rem;
    background: #433e3e;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-link {
    display: inline-block;
    text-decoration: none;
    transition: all 0.3s ease;
}

.image-link:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.responsive-image {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #ddd;
    cursor: pointer;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
}

.modal-content {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    background: none;
    border: none;
}

.download-btn-modal {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: #bb86fc;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
}

.download-btn-modal:hover {
    background-color: #a259f9;
}


/* Center close button */
.center-button {
    margin-top: 2rem;
    text-align: center;
}

.close-button {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;    
    background-color: #bb86fcc2;
    box-shadow: 0px 2px 2px rgba(0,0,0,0.5);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.close-button:hover {
    background-color: #a259f9;
    transform: scale(1.02);
}

.close-button:active {
    transform: scale(0.98);
}

button:focus,
a:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Scroll to Bottom Button */

.scroll-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #bb86fcc2;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 99;
    display: none; /* Will be shown by JS */
    align-items: center;
    justify-content: center;
}

/* Add this to support flex layout */
.scroll-btn i {
    display: flex;
}


/* Print-friendly styles */

@media print {
    body {
        background-color: white !important;
        color: black !important;
    }
    .theme-toggle, .close-button {
        display: none;
    }
    .container {
        box-shadow: none;
        background-color: white;
    }
    .question, .answer {
        border: 1px solid #000;
        background: white;
    }
    .icon {
        color: black !important;
    }
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem; /* More breathing room on small screens */
        max-width: 95%; /* Slightly wider on mobile */
    }
    
    /* Adjust text sizes */
    h1 {
        font-size: 1.8rem; /* Slightly smaller heading */
    }
    
    .question,
    .answer {
        font-size: 0.95rem; /* Slightly smaller text */
        line-height: 1.6; /* Tighter line height */
    }
    
    /* Adjust question/answer padding */
    .question,
    .answer {
        padding: 1.25rem 1.25rem 1.25rem 2.5rem; /* Reduced padding */
    }
    
    /* Adjust icon positioning */
    .question .icon,
    .answer .icon {
        top: 0.8rem;
        left: 0.8rem;
        font-size: 1.3rem;
    }
    
    /* Download buttons adjustment */
    .downloads {
        flex-direction: column; /* Stack buttons vertically */
        gap: 0.75rem;
    }
    
    .download-btn {
        width: 100%; /* Full width buttons */
        text-align: center;
    }
}
