/* Base Styles */
:root {
    --primary: #3498db;
    --primary-light: #85c1e9;
    /* 20-30% lighter version of primary */
    --secondary: #2c3e50;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --light: #ecf0f1;
    --dark: #34495e;
    --white: #ffffff;

}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
}

.container {
    flex: 1;
    width: 90%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Header Styles */
.dashboard-header {
    background-color: var(--secondary);
    color: var(--white);
    padding: 20px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.dashboard-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header nav a {
    color: var(--white);
    text-decoration: none;
    margin-left: 20px;
    transition: opacity 0.3s;
}

.dashboard-header nav a:hover {
    opacity: 0.8;
}

/* Auth Pages */
.auth-container {
    max-width: 500px;
    margin: 50px auto;
    padding: 30px;
    background-color: var(--white);
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-container h1 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--secondary);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Align checkbox to the left under the label */
}

.checkbox-group div {
    margin-top: 5px;
    /* Adds spacing between label and checkbox */
}


.alert {
    padding: 15px 20px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background-color: #e6f9e6;
    /* Soft green background */
    border-color: #28a745;
    /* Green border */
    color: #155724;
    /* Dark green text */
}

.alert-info {
    background-color: #e7f3fe;
    /* Soft blue background */
    border-color: #17a2b8;
    /* Blue border */
    color: #0c5460;
    /* Dark blue text */
}

.alert-danger {
    background-color: #f8d7da;
    /* Soft red background */
    border-color: #dc3545;
    /* Red border */
    color: #721c24;
    /* Dark red text */
}

.category-filter {
    margin-top: 20px;
}


.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

#description,
#question_text,
#explanation {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.question-form {
    margin-top: 20px;
    padding-top: 1px;
    /* Stops margin collapse */
}

.question-form h3 {
    margin: 5px 0;
}

#correct_answer {
    width: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

/* Button Styles */
/* Base button style - applies to both buttons and link-buttons */


.btn[disabled] {
    background-color: #cccccc !important;
    border-color: #cccccc;
    color: #666666;
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn,
button.btn,
a.btn {
    display: inline-flex;
    /* Better vertical alignment */
    align-items: center;
    /* Centers content vertically */
    justify-content: center;
    /* Centers content horizontally */
    padding: 10px 20px;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    font-family: inherit;
    /* Ensures same font family */
    line-height: 1.5;
    /* Consistent line height */
    transition: all 0.3s ease;
    /* Smooth transition for all properties */
    box-sizing: border-box;
    /* Includes padding in width/height */
    min-height: 40px;
    /* Minimum height for consistency */
    vertical-align: middle;
    /* Fixes alignment issues */
    margin: 2px;
    /* Small margin to prevent overlap */
}

/* Small button variant */
.btn-sm,
button.btn-sm,
a.btn-sm {
    padding: 5px 10px;
    font-size: 14px;
    min-height: 30px;
    /* Adjusted for smaller size */
    line-height: 1.3;
    /* Tighter line height for small buttons */
}

/* Hover states for both sizes */
.btn:hover,
button.btn:hover,
a.btn:hover {
    opacity: 0.8;
    text-decoration: none;
}

/* Focus states for accessibility */
.btn:focus,
button.btn:focus,
a.btn:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Fix for button elements specifically */
button.btn {
    -webkit-appearance: none;
    /* Removes default styling on Safari */
    -moz-appearance: none;
    /* Removes default styling on Firefox */
    appearance: none;
}

/* Fix for anchor elements specifically */
a.btn {
    /* Additional reset for links */
    position: relative;
    top: 0;
}


.btn-primary {
    background-color: var(--primary);
}

.btn-success {
    background-color: var(--success);
}

.btn-danger {
    background-color: var(--danger) !important;
}

.btn-warning {
    background-color: var(--warning);
}

/* Exam Grid */
.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 40px 0 20px;
}

.exam-card {
    background-color: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.exam-card:hover {
    transform: translateY(-5px);
}

/* Category Badge - Positioned at the Top Left */
.exam-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 3px;
    min-height: 30px;
    line-height: 1.3;
    z-index: 2;
}

/* Content Wrapper - Add padding to prevent overlap */
.exam-content {
    flex-grow: 1;
    margin-bottom: 15px;
    padding-top: 40px;
    /* Ensures space for the badge */
}

/* Exam Card Heading */
.exam-card h3 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 18px;
    position: relative;
    /* Ensures proper stacking */
    z-index: 1;
    /* Prevents it from overlapping the badge */
}


.exam-card p {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

/* Exam Meta Info */
.exam-meta {
    font-size: 14px;
    color: #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    /* Pushes to the bottom */
}

/* Start Exam Button - Positioned at Bottom Right */
.exam-card .btn {
    align-self: flex-end;
    margin-top: 15px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: bold;
}


/* Question Card */
.question-card {
    background-color: var(--white);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.question-number {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 10px;
}

.options {
    margin-top: 15px;
}

.option {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 4px;
    background-color: var(--light);
}

.option input {
    margin-right: 10px;
}

/* Timer */
.timer {
    background-color: var(--dark);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
    margin-top: 20px;
}

/* Results */
.results-container {
    background-color: var(--white);
    padding: 30px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.score-display {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
}

.passed {
    color: var(--success);
}

.failed {
    color: var(--danger);
}

/* Admin Dashboard */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--white);
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    color: var(--secondary);
    margin-bottom: 10px;
    font-size: 16px;
}

.stat-card p {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
}



.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.badge-success {
    background-color: var(--success);
    color: white;
}

.badge-danger {
    background-color: var(--danger);
    color: white;
}



/* Hero Header */
.hero-header {
    background-color: var(--primary);
    color: var(--white);
    padding: 80px 0;
    text-align: center;
}

.hero-header h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.hero-header p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 30px;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* Features */
.features {
    margin: 60px 0;
    text-align: center;
}

.features h2 {
    margin-bottom: 40px;
    color: var(--secondary);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.feature-card {
    background-color: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
}

.feature-card h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

/* Footer */
.main-footer {
    background-color: var(--secondary);
    color: var(--white);
    padding: 20px 0;
    text-align: center;
    margin-top: 60px;
    flex-shrink: 0;
}



/* Improved Results Page Styles */
.score-display {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.score-display.passed {
    background-color: rgba(46, 204, 113, 0.1);
    border: 1px solid #2ecc71;
}

.score-display.failed {
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
}

.score-display h2 {
    margin-bottom: 10px;
    color: inherit;
}

.score-details {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
}

.score-details .score {
    font-size: 24px;
    font-weight: bold;
}

.score-details .percentage {
    font-size: 24px;
    font-weight: bold;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    color: #7f8c8d;
}

/* Add to your CSS */
.question-tab.current {
    transform: scale(1.4);
    z-index: 2;
    box-shadow: 0 0 0 3px rgba(var(--primary), 0.3);
}

.progress-container {
    margin: 30px 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.progress-bar-wrapper {
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, #3498db, #2ecc71);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Tab styles */
.tab-buttons {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    border-bottom: 3px solid #3498db;
    font-weight: bold;
    color: #3498db;
}

.tab-content {
    display: none;
    padding: 20px 0;
}

.tab-content.active {
    display: block;
}

.performance-summary {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}


/* Responsive */
@media (max-width: 768px) {
    .dashboard-header .container {
        flex-direction: column;
        text-align: center;
    }

    .dashboard-header nav {
        margin-top: 15px;
    }

    .dashboard-header nav a {
        margin: 0 10px;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }
}


/* Categories Styles */
.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.category-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    width: auto;
    margin: 0;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    vertical-align: middle;
}

.filter-form .form-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-form select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.option-image {
    max-height: 150px;
    max-width: 100%;
    display: block;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .option-image {
        max-height: 100px;
    }
}


.pagination-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    gap: 5px;
    white-space: wrap;
    flex-wrap: wrap;
}


.pagination a,
.pagination span {
    padding: 8px 16px;
    margin: 0 4px;
    border: 1px solid #ddd;
    text-decoration: none;
    border-radius: 4px;
    color: var(--primary);
}

.pagination a.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination a:hover:not(.active) {
    background-color: #f5f5f5;
}

.checkbox-cell {
    width: 30px;
    text-align: center;
}

.actions {
    white-space: nowrap;
}

#select-all {
    margin: 0;
    vertical-align: middle;
}


.pagination .dots {
    padding: 8px 16px;
    color: #777;
}

.recent-attempts,
.recent-activity,
.exam-list,
.category-list {
    margin-top: 50px;
}

.question-image-preview,
.option-image-preview {
    max-height: 150px;
    display: block;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 3px;
}

.file-upload-note {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}

.image-preview-container {
    position: relative;
    display: inline-block;
    margin-top: 5px;
}

.remove-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(231, 76, 60, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-image-btn:hover {
    background: #e74c3c;
}

.remove-image-checkbox {
    display: none;
}

/* Base table styling */
.data-table,
.activity-table,
.attempts-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
}

/* Header styling */
.data-table thead tr,
.activity-table thead tr,
.attempts-table thead tr {
    background-color: #444;
    color: #e7f3fe;
    font-weight: 600;
}

/* Table cells */
.data-table th,
.data-table td,
.activity-table th,
.activity-table td,
.attempts-table th,
.attempts-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

/* Striped rows */
.data-table tbody tr:nth-child(odd),
.activity-table tbody tr:nth-child(odd),
.attempts-table tbody tr:nth-child(odd) {
    background-color: #fafafa;
}

/* Hover effect */
.data-table tbody tr:hover,
.activity-table tbody tr:hover,
.attempts-table tbody tr:hover {
    background-color: #f0f8ff;
    cursor: pointer;
}

/* Table container */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    white-space: nowrap;
}

/* Checkbox cell alignment */
.checkbox-cell {
    text-align: center;
    width: 40px;
}






/* Custom dropdown styles */
.custom-dropdown {
    position: relative;
    display: inline-block;
    min-width: 200px;
}

.dropdown-toggle {
    width: 100%;
    padding: 8px 30px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    text-align: left;
    cursor: pointer;
    position: relative;
}

.dropdown-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

.dropdown-options {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-options li {
    padding: 8px 12px;
    cursor: pointer;
}

.dropdown-options li:hover {
    background-color: #f5f5f5;
}

.dropdown-options li.selected {
    background-color: #e7f3fe;
}

/* Scrollbar styling */
.dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #555;
}