:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-gradient: linear-gradient(135deg, #0b1120 0%, #111827 100%);
    --chat-bg: #1f2937;
    --bot-msg: #374151;
    --user-msg: #6366f1;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --glass: rgba(17, 24, 39, 0.75);
    --glass-border: rgba(148, 163, 184, 0.12);
}

* {
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-size: 13px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #0b1120;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: #f1f5f9;
}

.container {
    width: 98%;
    max-width: 1000px;
    height: 98vh;
    background: var(--glass);
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    margin: 1vh auto;
}

header {
    padding: 8px 24px;
    background: rgba(17, 24, 39, 0.5);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    text-align: left;
}

h1 {
    margin: 0;
    font-size: 1.6rem;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

/* Tab styling */
.tabs {
    display: flex;
    justify-content: flex-end;
    background: transparent;
    padding: 0;
    gap: 4px;
}

.tab-link {
    background-color: transparent;
    color: var(--text-muted);
    padding: 8px 16px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    outline: none;
}

.tab-link:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.tab-link.active {
    color: white;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

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

.guide-summary {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #34d399; /* Light green for dark mode readability */
}

.guide-summary strong {
    font-weight: 800;
}

.guide-summary ol {
    margin: 4px 0 0 20px;
    padding: 0;
}

.guide-summary li {
    margin-bottom: 2px;
}

/* Paper Settings for Teachers */
.paper-settings {
    background: #1f2937;
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.settings-top {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    align-items: flex-end;
}





.question-config {
    width: 100%;
    margin-top: 4px;
    border-top: 1px solid #374151;
    padding-top: 8px;
}

.section-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    display: block;
}

.config-header-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 4px;
}

.config-header-row {
    display: grid;
    grid-template-columns: 25px 55px 55px 2fr 50px 40px 1.5fr 2.5fr 35px;
    gap: 12px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
}

.config-header-row span {
    text-align: center;
}

.question-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border-top: 2px solid #4b5563;
    margin-top: 4px;
}

.question-row {
    display: grid;
    grid-template-columns: 25px 55px 55px 2fr 50px 40px 1.5fr 2.5fr 35px;
    gap: 12px;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid #4b5563;
}

.show-more-btn {
    width: 100%;
    margin-top: 12px;
    background: #1f2937;
    color: var(--primary);
    border: 1.5px dashed #4b5563;
    padding: 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.show-more-btn:hover {
    background: #374151;
    border-color: var(--primary);
    transform: translateY(0);
}

.question-row:hover {
    background: #374151;
}

.question-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.question-row label {
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 8px;
}

/* Clear borders for all dropdowns and inputs */
.question-row select,
.question-row input[type="number"] {
    padding: 4px 2px;
    font-size: 13px;
    border: 1.5px solid #4b5563;
    border-radius: 6px;
    outline: none;
    width: 100%;
    min-width: 55px;
    text-align: center;
    background: #1f2937;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03), inset 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.question-row select:focus,
.question-row input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
}

.question-row select:disabled,
.question-row input:disabled {
    background: #111827;
    border-color: #e2e8f0;
    cursor: not-allowed;
    color: #94a3b8;
}

.row-total {
    font-weight: 800;
    font-size: 13px;
    color: var(--primary);
    text-align: center;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 90px;
}

.setting-group label {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
}

.paper-settings select,
.paper-settings input[type="text"],
.paper-settings input[type="number"] {
    height: 38px;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1.5px solid #4b5563;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    background: #1f2937;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05), inset 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.paper-settings select:focus,
.paper-settings input[type="text"]:focus,
.paper-settings input[type="number"]:focus {
    border-color: var(--primary);
    background: #1f2937;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06), inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.total-display-wrapper {
    height: 38px;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1.5px solid #4b5563;
    border-radius: 10px;
    background: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05), inset 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.total-display-wrapper span {
    font-size: 13px; /* Adjusted for visual similarity */
    font-weight: 800;
    color: #16a34a;
    line-height: 1;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chat-box::-webkit-scrollbar,
.tab-content::-webkit-scrollbar {
    width: 6px;
}

.chat-box::-webkit-scrollbar-thumb,
.tab-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.message {
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 85%;
    font-size: 13px;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.bot {
    align-self: flex-start;
    background-color: #f1f5f9;
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
    border: 1px solid #374151;
}

.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

.input-area {
    padding: 12px 16px;
    background: rgba(17, 24, 39, 0.5);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 12px;
    backdrop-filter: blur(10px);
}

input[type="text"] {
    flex: 1;
    padding: 12px 20px;
    border: 1.5px solid #4b5563;
    border-radius: 12px;
    outline: none;
    font-size: 13px;
    background: #1f2937;
}

input[type="text"]:focus {
    border-color: var(--primary);
}

button {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.typing-indicator {
    padding: 8px 14px;
    background: #1f2937;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: none;
    align-self: flex-start;
    gap: 4px;
    border: 1px solid #374151;
}

.dot {
    width: 5px;
    height: 5px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }
}

footer {
    padding: 12px;
    background: rgba(17, 24, 39, 0.5);
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* Resource Library Styles */
.resource-header {
    margin-bottom: 24px;
}

.resource-header h2 {
    margin: 0;
    font-size: 13px;
}

.resource-header p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.refresh-btn {
    background: #1f2937;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 10px;
    margin-top: 12px;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.resource-card {
    background: #1f2937;
    border-radius: 20px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.resource-icon {
    font-size: 2.5rem;
    text-align: center;
    background: #111827;
    padding: 16px;
    border-radius: 16px;
}

.resource-info h3 {
    margin: 0;
    font-size: 13px;
}

.resource-info .category {
    font-size: 13px;
    color: var(--secondary);
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 2px;
    display: block;
}

.download-link {
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.autocomplete-items {
    position: absolute;
    border: 1.5px solid #4b5563;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    border-radius: 0 0 10px 10px;
    background-color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.autocomplete-items div {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    color: #374151;
}

.autocomplete-items div:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.btn-logout {
    position: absolute;
    right: 0;
    top: -5px;
    padding: 6px 12px;
    background: #fee2e2;
    color: #ef4444;
    border: 1.5px solid #fca5a5;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #fecaca;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
}