/**
 * Research Test Delivery System - Custom Styles
 * 
 * This stylesheet provides additional styling beyond Bootstrap 5 defaults.
 * Focused on clean, minimal, mobile-friendly design.
 */

/* ==========================================================================
   Root Variables
   ========================================================================== */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --dark-gradient: linear-gradient(135deg, #434343 0%, #000000 100%);
    --info-highlight: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    --info-border: #ffc107;
    --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Global Styles
   ========================================================================== */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* ==========================================================================
   Important Notice Box - Highlighted for Visibility
   ========================================================================== */

.important-notice-box {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    position: relative;
    box-shadow: 0 3px 10px rgba(255, 193, 7, 0.3);
}

.important-notice-box .alert-heading {
    color: #856404;
    font-weight: 800;
    font-size: 1rem;
    display: flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.important-notice-box .alert-heading i {
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

.important-notice-box ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.important-notice-box ul li {
    padding: 0.2rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.important-notice-box ul li strong {
    color: #dc3545;
    font-weight: 800;
    text-decoration: underline;
}

/* ==========================================================================
   Login Page Styles
   ========================================================================== */

.login-page .bg-gradient-primary {
    background: var(--primary-gradient);
    min-height: 100vh;
}

.login-page .card {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    border: none;
}

.login-page .card-header {
    border-radius: 0 !important;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
}

.login-page .card-header h2 {
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-page .card-body {
    padding: 2rem;
}

.login-page .form-control {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.login-page .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.login-page .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.login-page .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* Gender button group styling */
.login-page .btn-check + .btn-outline-secondary {
    border-radius: 8px;
    border: 2px solid #dee2e6;
    transition: all 0.2s ease;
}

.login-page .btn-check:checked + .btn-outline-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
}

/* ==========================================================================
   Consent Page Styles
   ========================================================================== */

.consent-page .card {
    border-radius: 1rem;
    border: none;
    box-shadow: var(--shadow-medium);
}

.consent-page .card-header {
    border-radius: 1rem 1rem 0 0 !important;
    padding: 1.5rem;
}

.consent-page .consent-section {
    margin-bottom: 1.5rem;
}

.consent-page .consent-section h5 {
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.consent-page .consent-section .bg-light {
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.consent-page .consent-checkbox {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border: 2px solid #ffc107 !important;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.consent-page .consent-checkbox:has(input:checked) {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745 !important;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
}

.consent-page .alert-warning {
    border-radius: 10px;
    border-left: 4px solid #ffc107;
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
}

.consent-page .btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    border-radius: 8px;
    padding: 0.875rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.consent-page .btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.4);
}

/* ==========================================================================
   Compact Layout - Fit Everything on One Screen
   ========================================================================== */

/* Reduce main container padding */
main.container {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* Compact card styling */
.card.shadow {
    margin-bottom: 0;
}

.card.shadow .card-header {
    padding: 0.5rem 1rem;
}

.card.shadow .card-body {
    padding: 1rem 1.5rem;
}

/* Compact question text */
.question-text {
    margin-bottom: 0.75rem !important;
}

.question-text h5 {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 0.5rem !important;
}

/* Compact shared stem */
.shared-stem-box {
    padding: 0.75rem !important;
    margin-bottom: 0.75rem !important;
    font-size: 0.9rem;
}

.shared-stem-box .stem-image {
    margin-top: 0.5rem !important;
}

.shared-stem-box .stem-image img {
    max-height: 150px !important;
}

/* Compact MCQ options */
.option-item {
    padding: 0.5rem 0.75rem !important;
    margin-bottom: 0.5rem !important;
}

.option-item:last-child {
    margin-bottom: 0 !important;
}

/* Compact form elements */
.mb-4 {
    margin-bottom: 0.75rem !important;
}

.mb-3 {
    margin-bottom: 0.5rem !important;
}

.form-label {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

/* Smaller textareas */
textarea.form-control {
    min-height: 60px !important;
    font-size: 0.9rem;
}

/* Compact confidence options */
.confidence-options {
    gap: 1rem !important;
    margin-top: 0.25rem !important;
}

.confidence-options .btn {
    padding: 0.4rem 1rem !important;
    font-size: 0.85rem;
    min-width: 130px;
}

/* Compact buttons */
.btn-lg {
    padding: 0.5rem 1.5rem !important;
    font-size: 0.95rem;
}

/* Compact navigation */
.mt-4 {
    margin-top: 0.75rem !important;
}

/* Compact navbar */
.navbar {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.navbar-brand {
    font-size: 1rem;
}

/* Compact progress bar */
.progress {
    height: 4px !important;
}

/* Compact footer */
.footer {
    padding: 0.5rem 0 !important;
    font-size: 0.8rem;
}

/* Compact alerts */
.alert {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.alert h6 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

/* Compact hint card */
.hint-card {
    padding: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

.hint-card h5 {
    font-size: 1rem;
    margin-bottom: 0.25rem !important;
}

.hint-card .lead {
    font-size: 0.9rem;
}

/* Compact attempt summary */
.first-attempt-summary {
    padding: 0.5rem 0.75rem !important;
    margin-bottom: 0.75rem !important;
    font-size: 0.9rem;
}

/* Compact form text */
.form-text {
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

/* ==========================================================================
   Question Pages (MCQ & FTR)
   ========================================================================== */

.question-page .card,
.card.shadow {
    border-radius: 1rem;
    border: none;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
}

.question-page .card-header,
.card.shadow .card-header {
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.question-text h5 {
    line-height: 1.7;
    color: #333;
    font-size: 1.15rem;
}

/* Shared Stem Box */
.shared-stem-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border-left: 5px solid #667eea !important;
}

/* MCQ Options */
.option-item {
    cursor: pointer;
    transition: all 0.25s ease;
    border-radius: 10px !important;
    border: 2px solid #e9ecef !important;
    background: #fff;
}

.option-item:hover:not(:has(input:disabled)) {
    background-color: #f8f9fa;
    border-color: #667eea !important;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.option-item:has(input:checked) {
    background: linear-gradient(135deg, #e8eaff 0%, #d4d8ff 100%);
    border-color: #667eea !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.option-letter {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* FTR Text Areas */
.ftr-form textarea,
textarea.form-control {
    resize: vertical;
    min-height: 120px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

textarea.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Hint Card */
.hint-card {
    border-left: 5px solid #17a2b8 !important;
    border-radius: 10px;
    background: linear-gradient(135deg, #e7f5ff 0%, #d4edff 100%);
}

.hint-card .lead {
    font-size: 1rem;
    color: #0c5460;
}

/* Transfer Question Notice */
.alert-warning {
    border-radius: 10px;
    border-left: 5px solid #ffc107;
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
}

/* Confidence Options - 3-button style */
.confidence-options {
    flex-wrap: wrap;
}

.confidence-options .btn {
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 160px;
}

.confidence-options .btn-check:checked + .btn-outline-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
    transform: scale(1.05);
}

.confidence-options .btn-check:checked + .btn-outline-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    border-color: transparent;
    color: #212529;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
    transform: scale(1.05);
}

.confidence-options .btn-check:checked + .btn-outline-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    transform: scale(1.05);
}

/* Attempt Cards */
.attempt-card {
    border-radius: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
}

.first-attempt-summary {
    border-left: 4px solid #6c757d;
    border-radius: 10px;
}

/* Submit Buttons */
.btn-lg {
    border-radius: 10px;
    padding: 0.875rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary.btn-lg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary.btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-success.btn-lg {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
}

.btn-success.btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.4);
}

/* Progress Bar Enhancement */
.progress {
    height: 8px !important;
    background-color: #e9ecef;
}

.progress-bar.bg-success {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%) !important;
}

/* ==========================================================================
   Likert Scale
   ========================================================================== */

.likert-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    border: 1px solid #e9ecef;
    padding: 1.5rem;
}

.likert-scale {
    gap: 0.75rem;
}

.likert-option {
    flex: 1;
    min-width: 60px;
}

.likert-option .form-check-input {
    width: 1.75em;
    height: 1.75em;
    margin: 0 auto 0.5rem;
    cursor: pointer;
    border: 2px solid #dee2e6;
    transition: all 0.2s ease;
}

.likert-option .form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.likert-option .form-check-label {
    cursor: pointer;
    padding: 0.875rem 0.5rem;
    border-radius: 10px;
    transition: all 0.25s ease;
    border: 2px solid transparent;
    background: white;
}

.likert-option:hover .form-check-label {
    background-color: #f0f0f0;
    border-color: #dee2e6;
    transform: translateY(-2px);
}

.likert-option .form-check-input:checked + .form-check-label {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.likert-number {
    font-weight: 700;
    font-size: 1.25rem;
}

/* ==========================================================================
   Completion Page
   ========================================================================== */

.completion-page .card {
    border-radius: 1.5rem;
    border: none;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
}

.completion-page .completion-icon {
    animation: bounceIn 0.8s ease;
}

.completion-page .completion-icon .rounded-circle {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
    box-shadow: 0 8px 30px rgba(40, 167, 69, 0.2);
}

.completion-page h2.text-success {
    font-weight: 700;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.completion-page .bg-light {
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
}

.completion-page .alert-info {
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #e7f5ff 0%, #d4edff 100%);
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Admin Dashboard
   ========================================================================== */

.admin-dashboard .card {
    border-radius: 1rem;
    border: none;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.admin-dashboard .card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.admin-dashboard .table {
    border-radius: 10px;
    overflow: hidden;
}

.admin-dashboard .table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: none;
}

.admin-dashboard .table td {
    vertical-align: middle;
    border-color: #f0f0f0;
}

.admin-dashboard .progress {
    background-color: #e9ecef;
    border-radius: 10px;
    height: 10px;
}

.admin-dashboard .progress-bar {
    border-radius: 10px;
}

/* Stat Cards */
.admin-dashboard .stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 1rem;
}

.admin-dashboard .stat-card.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.admin-dashboard .stat-card.warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
}

.admin-dashboard .stat-card.info {
    background: linear-gradient(135deg, #17a2b8 0%, #0dcaf0 100%);
}

/* Student Detail Page */
.admin-student-detail .ftr-response-card {
    background-color: #f8f9fa;
}

.admin-student-detail .attempt-box {
    border-left: 3px solid #0d6efd;
}

.admin-student-detail .attempt-box:nth-child(2) {
    border-left-color: #198754;
}

/* ==========================================================================
   Navbar / Header
   ========================================================================== */

.navbar {
    background: white !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.navbar-brand {
    font-weight: 700;
    color: #333 !important;
}

.navbar .badge {
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

/* ==========================================================================
   Progress Bar (Fixed Top)
   ========================================================================== */

.progress[style*="height: 6px"] {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* Mobile (< 576px) */
@media (max-width: 575.98px) {
    .card-body {
        padding: 1rem;
    }
    
    .question-text h5 {
        font-size: 1rem;
    }
    
    .option-item {
        padding: 0.75rem !important;
    }
    
    .likert-option .form-check-label {
        padding: 0.5rem 0.25rem;
    }
    
    .likert-label {
        font-size: 0.65rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    /* Admin tables scroll horizontally on mobile */
    .admin-dashboard .table td,
    .admin-dashboard .table th {
        white-space: nowrap;
    }
}

/* Tablets (576px - 768px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .likert-option {
        min-width: 60px;
    }
}

/* Desktop (≥768px) */
@media (min-width: 768px) {
    .question-text h5 {
        font-size: 1.25rem;
    }
    
    .option-item {
        padding: 1rem 1.25rem !important;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.min-vh-75 {
    min-height: 75vh;
}

.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   Animation Classes
   ========================================================================== */

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .navbar,
    .btn,
    .progress,
    footer {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    body {
        background: white !important;
    }
}

/* ==========================================================================
   Footer Styles
   ========================================================================== */

.footer {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%) !important;
    font-size: 0.9rem;
}

.footer .text-muted {
    color: #6c757d !important;
}
