/* Rasch Backend Admin Panel - Modern CSS - Updated */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Layout */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.sidebar-logo i {
    font-size: 1.5rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.nav-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-left-color: var(--primary-color);
}

.nav-item.active {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.nav-item i {
    width: 1.25rem;
    margin-right: 0.75rem;
    font-size: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-menu:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Content Area */
.content {
    padding: 2rem;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.stat-icon.primary { background: var(--primary-color); }
.stat-icon.success { background: var(--success-color); }
.stat-icon.warning { background: var(--warning-color); }
.stat-icon.info { background: var(--info-color); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-change {
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-change.positive { color: var(--success-color); }
.stat-change.negative { color: var(--danger-color); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.25;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.closed-test-container .form-group {
    margin-bottom: 2rem;
}

.closed-test-container .form-group:last-of-type {
    margin-bottom: 1.5rem;
}

/* Question Form Layout */
.question-number-section {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.question-type-info .alert {
    margin-bottom: 0;
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.question-fields-section {
    min-height: 200px;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-label.required::after {
    content: " *";
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.form-control:invalid {
    border-color: var(--danger-color);
}

.form-control:invalid:focus {
    box-shadow: 0 0 0 3px rgb(239 68 68 / 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgb(239 68 68 / 0.1);
}

.form-control.is-valid {
    border-color: var(--success-color);
}

.form-control.is-valid:focus {
    box-shadow: 0 0 0 3px rgb(16 185 129 / 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Form validation */
.form-feedback {
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.form-feedback.invalid {
    color: var(--danger-color);
}

.form-feedback.valid {
    color: var(--success-color);
}

/* Form groups with icons */
.form-group-icon {
    position: relative;
}

.form-group-icon .form-control {
    padding-left: 2.5rem;
}

.form-group-icon .form-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Checkbox and Radio */
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.form-check-input {
    margin-right: 0.5rem;
    width: 1rem;
    height: 1rem;
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* Tables */
.table-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary { background: rgb(37 99 235 / 0.1); color: var(--primary-color); }
.badge-success { background: rgb(16 185 129 / 0.1); color: var(--success-color); }
.badge-warning { background: rgb(245 158 11 / 0.1); color: var(--warning-color); }
.badge-danger { background: rgb(239 68 68 / 0.1); color: var(--danger-color); }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgb(16 185 129 / 0.1);
    border-color: var(--success-color);
    color: var(--success-color);
}

.alert-danger {
    background: rgb(239 68 68 / 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background: rgb(245 158 11 / 0.1);
    border-color: var(--warning-color);
    color: var(--warning-color);
}

/* Loading */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 2rem;
}

.login-card {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

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

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.login-form {
    margin-bottom: 1rem;
}

.w-100 {
    width: 100%;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.75rem;
}

.col-md-4,
.col-md-8 {
    padding: 0.75rem;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-md-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

@media (max-width: 768px) {
    .col-md-4,
    .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Flex utilities */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }

/* Display utilities */
.d-none { display: none; }
.d-md-none { display: none; }

@media (min-width: 768px) {
    .d-md-none { display: block; }
}

@media (max-width: 767px) {
    .d-md-none { display: none; }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* Additional form styles */
textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    appearance: none;
}

/* Animation for modal */
.modal {
    animation: modalFadeIn 0.3s ease;
}

.modal-dialog {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Question Management Styles */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.question-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    background: var(--bg-primary);
    transition: all 0.2s ease;
}

.question-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

/* Finalized test styles */
.question-item.finalized {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
    opacity: 0.8;
}

.question-item.finalized .question-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
    color: white !important;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.question-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.question-number {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.question-actions {
    display: flex;
    gap: 0.5rem;
}

.question-content {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.answer-preview {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.answer-preview strong {
    color: var(--text-primary);
}

/* Question Types Info */
.question-types {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.type-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
}

.type-item strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.25rem;
}

.type-item .text-muted {
    font-size: 0.75rem;
}

/* Statistics */
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item strong {
    color: var(--text-primary);
}

/* Form Text Helper */
.form-text {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-text.text-success {
    color: var(--success-color);
}

/* Input Group */
.input-group {
    display: flex;
    width: 100%;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-group-append {
    display: flex;
}

.input-group-append .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 1px solid var(--border-color);
}

.input-group .form-control:focus + .input-group-append .btn {
    border-color: var(--primary-color);
}

/* Form Actions */
.form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

.btn-group .btn {
    margin: 0;
}

/* Question Form Specific */
#questionFormCard {
    border-left: 3px solid var(--primary-color);
}

#questionFormCard .card-header {
    background: var(--bg-tertiary);
}

/* Smooth transitions */
.card {
    transition: all 0.3s ease;
}

/* Auto-next checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    margin: 0;
    width: 1rem;
    height: 1rem;
}

.form-check-label {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Answer Options Grid */
.answer-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

.answer-options-grid.answer-options-6 {
    grid-template-columns: repeat(3, 1fr);
}

.answer-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    transition: all 0.2s ease;
    cursor: pointer;
}

.answer-option:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.answer-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.answer-option input[type="radio"]:checked + .answer-label {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.answer-option input[type="radio"]:checked {
    border-color: var(--primary-color);
}

.answer-option.checked {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.answer-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    border-radius: calc(var(--border-radius) - 2px);
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.answer-label:hover {
    background: var(--bg-secondary);
}

/* Focus styles */
.answer-option input[type="radio"]:focus + .answer-label {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Closed Test Styles */
.closed-test-container {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 0;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: none;
}

.answer-variant-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.badge-a {
    background: linear-gradient(135deg, #007bff, #0056b3);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.badge-b {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.closed-test-textarea {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 180px;
    width: 100%;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.closed-test-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.closed-test-textarea:valid {
    border-color: var(--success-color);
}

.char-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.char-counter.text-warning {
    color: var(--warning-color) !important;
}

.char-counter.text-danger {
    color: var(--danger-color) !important;
}

.closed-test-tips {
    margin-top: 1.5rem;
}

.closed-test-tips .alert {
    border-left: 4px solid var(--info-color);
    background: rgba(23, 162, 184, 0.1);
    border-color: rgba(23, 162, 184, 0.2);
}

.closed-test-tips ul {
    padding-left: 1.2rem;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

.tip-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    background: rgba(23, 162, 184, 0.1);
    border-radius: 4px;
    border-left: 3px solid var(--info-color);
}



/* Closed Test Preview Styles */
.closed-test-preview {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.variant-preview {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: transparent;
    border-radius: 4px;
    border: none;
}

.variant-preview .variant-badge {
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
    background: var(--text-muted) !important;
    color: white !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-weight: 600;
}

.variant-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-primary);
}

/* Dashboard Action Cards */
.dashboard-actions-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

.dashboard-actions-card .card-header {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white !important;
    border-bottom: none;
    padding: 2rem 1.5rem;
}

.dashboard-actions-card .card-header .card-title {
    color: white !important;
    margin-bottom: 0;
}

.dashboard-actions-card .card-header .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.dashboard-action-btn {
    border: none;
    border-radius: 15px;
    padding: 3rem 2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

.dashboard-action-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.dashboard-action-btn:active {
    transform: translateY(-2px);
}

.dashboard-action-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;
}

.dashboard-action-btn:hover::before {
    left: 100%;
}

.dashboard-action-btn i {
    opacity: 0.9;
}

.dashboard-action-btn:hover i {
    opacity: 1;
    transform: scale(1.1);
    transition: all 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .question-number-section {
        padding: 1rem;
    }

    .closed-test-container {
        padding: 1.5rem 1rem;
        margin-top: 0;
    }

    .closed-test-textarea {
        min-height: 140px;
        padding: 1rem;
        font-size: 1rem;
    }

    .tips-grid {
        grid-template-columns: 1fr;
    }



    .question-type-info .alert {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .dashboard-actions-card .card-header {
        padding: 1.5rem 1rem;
    }

    .dashboard-action-btn {
        min-height: 160px;
        padding: 2rem 1rem;
    }

    .dashboard-action-btn i {
        font-size: 2rem !important;
    }

    .dashboard-action-btn .fs-5 {
        font-size: 1.1rem !important;
    }
}

@media (max-width: 576px) {
    .answer-options-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .answer-options-grid.answer-options-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .answer-option {
        min-height: 2.5rem;
    }

    .answer-label {
        font-size: 1rem;
    }
}

/* Question Type Alerts */
.alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
}

.alert-info {
    color: var(--info-color);
    background-color: rgb(6 182 212 / 0.1);
    border-color: var(--info-color);
}

.alert-warning {
    color: var(--warning-color);
    background-color: rgb(245 158 11 / 0.1);
    border-color: var(--warning-color);
}

.alert-primary {
    color: var(--primary-color);
    background-color: rgb(37 99 235 / 0.1);
    border-color: var(--primary-color);
}

/* Responsive Question Management */
@media (max-width: 768px) {
    .question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .question-info {
        width: 100%;
    }

    .question-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .type-item {
        padding: 0.5rem;
    }

    .stat-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

/* Pagination Styles */
.pagination {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
}

.page-item {
    display: flex;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 2.5rem;
    height: 2.5rem;
}

.page-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.page-item.active .page-link {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-item.active .page-link:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.page-item.disabled .page-link {
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    cursor: not-allowed;
}

.page-item.disabled .page-link:hover {
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.pagination-info {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Search and Filter Styles */
.input-group {
    display: flex;
    width: 100%;
    position: relative;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    flex: 1;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 1px solid var(--primary-color);
}

.input-group .form-control:focus {
    z-index: 2;
}

.input-group .form-control:focus + .btn {
    border-left-color: var(--primary-color);
}

/* Grid System for Search/Filter */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.75rem;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0.75rem;
}

@media (max-width: 768px) {
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }

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

/* Badge improvements */
.badge-light {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Table responsive improvements */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
    }

    .table {
        min-width: 600px;
    }
}

/* Loading states */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Smooth animations */
.card,
.table-container,
.pagination {
    transition: all 0.3s ease;
}

/* Focus improvements */
.page-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    z-index: 3;
}

/* Stat card styles */
.stat-card {
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.stat-card h5 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-card h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: bold;
}

/* Loader styles */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    color: var(--text-primary);
    font-weight: 500;
}

/* Users Page Styles */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 2rem;
    margin: 0 auto;
}

.user-details {
    flex: 1;
}

.user-details strong {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
}

.stats-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-details-modal .user-info-card {
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.user-details-modal .user-stats {
    padding: 1rem;
}

.user-details-modal .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.user-details-modal .stat-item:last-child {
    border-bottom: none;
}

.user-details-modal .stat-item label {
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}

.user-details-modal .stat-item span {
    font-weight: 500;
}

/* Secondary stat cards for additional dashboard stats */
.stat-card.secondary {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
}

.stat-card.secondary .stat-header .stat-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-card.secondary .stat-value {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.stat-card.secondary .stat-change {
    font-size: 0.75rem;
}

/* Pagination improvements */
.pagination-sm .page-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.pagination-info {
    color: var(--text-muted);
}

/* Badge improvements */
.badge.bg-orange {
    background-color: #fd7e14 !important;
}

/* Search input improvements */
.input-group .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* Table improvements for users */
.table td code {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: var(--primary-color);
}

/* Dashboard action buttons improvements */
.dashboard-action-btn {
    transition: all 0.3s ease;
    border: none;
    box-shadow: var(--shadow-md);
}

.dashboard-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .stats-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .dashboard-action-btn {
        margin-bottom: 1rem;
    }

    .stat-card.secondary .stat-value {
        font-size: 1.25rem;
    }
}
