/* VDB v2 Stylesheet - Modern Structured Design */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Quizt Brand Palette */
    --primary-color: #1b1a17;
    --primary-light: #ffeee4;
    --accent-color: #ff5f00;
    --accent-hover: #e65600;

    --header-bg: #1b1a17;
    --bg-color: #f9fafb;
    --white: #ffffff;

    --text-color: #111827;
    --text-muted: #4b5563;
    --text-light: #9ca3af;

    --border-color: #e5e7eb;
    --border-hover: #d1d5db;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;

    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
}

/* Persistent Header */
.main-header {
    background: var(--header-bg);
    color: var(--white);
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo span {
    color: var(--accent-color);
}

.main-nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.main-nav a {
    color: #d1d5db;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

.main-nav .btn-logout {
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-left: 12px;
}

/* Nav Dropdown */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-trigger {
    color: #d1d5db;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.nav-dropdown:hover .nav-dropdown-trigger,
.nav-dropdown.active .nav-dropdown-trigger {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    min-width: 180px;
    box-shadow: var(--shadow);
    border-radius: var(--radius-lg);
    padding: 8px;
    z-index: 1001;
    margin-top: 8px;
    border: 1px solid var(--border-color);
}

/* Hover bridge to prevent closing when moving mouse to content */
.nav-dropdown-content::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
    animation: dropIn 0.2s ease-out;
}

.nav-dropdown-content a {
    color: var(--text-color) !important;
    display: block !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    background: none !important;
    border-radius: var(--radius) !important;
    text-align: left;
}

.nav-dropdown-content a:hover,
.nav-dropdown-content a.active {
    background: var(--primary-light) !important;
    color: var(--accent-color) !important;
}

@keyframes dropIn {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Inline Editing */
.editable {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s, border 0.2s;
    border: 1px solid transparent;
}

.editable:hover {
    background: var(--primary-light);
    border: 1px dashed var(--accent-color);
}

.editable:focus {
    background: white;
    border: 1px solid var(--accent-color);
    outline: none;
    cursor: text;
}

/* Q&A Card Styling */
.qa-card {
    background: white;
    border: 1px solid #f1f1f1;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.qa-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

.question-part {
    background: #fcfcfc;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f1f1;
}

.answer-part {
    background: white;
    padding: 16px 20px;
}

.qa-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
}

.question-label {
    color: var(--text-light);
}

.answer-label {
    color: var(--accent-color);
}

.qa-content {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}

.save-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    display: none;
    /* Controlled by JS */
    z-index: 1000;
}

.save-indicator.error {
    background: var(--error-color);
}

/* Auth Pages */
/* Page Layout */
.page-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Card Styling */
.card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

/* Search Bar (Centered Header Style) */
.search-hero {
    text-align: center;
    margin-bottom: 48px;
    padding: 40px 0;
}

.search-hero h2 {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 24px;
}

/* Refined Search Input */
.search-bar-wrap {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    display: flex;
    gap: 12px;
}

.search-input-field {
    flex: 1;
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.search-input-field:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.btn-search {
    background: var(--accent-color);
    color: var(--white);
    border: none;
    padding: 0 32px;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-search:hover {
    background: #2563eb;
}

/* Segmented Control (Filters) */
.filter-group {
    display: inline-flex;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 10px;
    margin-top: 24px;
}

.filter-group label {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.filter-group input {
    display: none;
}

.filter-group label:has(input:checked) {
    background: var(--white);
    color: var(--accent-color);
    box-shadow: var(--shadow-sm);
}

/* Search Result List */
.results-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.1em;
    margin-bottom: 24px;
}

.result-item {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.result-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--border-hover);
}

.result-tag {
    font-size: 10px;
    background: #eff6ff;
    color: #1e40af;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 12px;
}

.result-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-question {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
}

.result-answer {
    background: #f9fafb;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    color: #374151;
}

.result-answer strong {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-light);
    display: block;
    margin-bottom: 8px;
}

.answer-body {
    font-weight: 500;
    color: var(--text-color);
}

/* Form Groups for Import */
.form-section-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-group input,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
}

.form-group textarea {
    min-height: 250px;
}

.btn-primary {
    background: var(--accent-color);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
}

/* Login Page Styling */
.auth-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -0.05em;
}

/* Data Tables for Overview */
.data-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.1em;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: var(--bg-color);
}

.quiz-badge {
    display: inline-block;
    padding: 4px 8px;
    background: var(--bg-color);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.action-links {
    display: flex;
    gap: 12px;
}

.btn-delete {
    color: var(--error-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.btn-delete:hover {
    text-decoration: underline;
}

.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-light);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 16px;
        padding: 16px 0;
    }

    .main-header {
        height: auto;
    }

    .search-bar-wrap {
        flex-direction: column;
    }

    .btn-search {
        padding: 14px;
    }

    .main-nav {
        width: 100%;
        justify-content: center;
    }
}