:root {
    --bg-main: #f8f9fa;
    --card-bg: #ffffff;
    --panel-bg: #e7f1ff;
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --warning: #ffc107;
    --danger: #dc3545;
    --success: #198754;
    --warning-dark: #d39e00;
    --danger-dark: #c82333;
    --success-dark: #157347;
    
    /* Question Type Colors - Softer/Pastel versions */
    --vof-color: #fff1f0;  /* Subtle Red */
    --choices-color: #f0f7ff; /* Subtle Blue */
    --essay-color: #fffbe6; /* Subtle Gold */
}

/* Question Card Variants */
.gl-card.card-vof {
    background-color: var(--vof-color);
}
.gl-card.card-choices {
    background-color: var(--choices-color);
}
.gl-card.card-essay {
    background-color: var(--essay-color);
}

.main-container {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
    /* Centering and Width Restriction */
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}




.add-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary) !important;
    color: white;
    border: none;
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    transition: transform 0.2s;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.add-btn:hover {
    transform: scale(1.1);
    background-color: var(--primary-dark);
}

.edit-section {
    margin-bottom: 25px;
}

.edit-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--primary);
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--primary);
}

.btn-save {
    width: 100%;
    border: none;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-save:disabled,
.btn-save[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
    background-color: #6c757d !important; /* Force gray for disabled state to satisfy user preference */
    border-color: #6c757d !important;
}

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

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

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

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

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

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

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

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




/* --- GENERALIZED COMPONENTS (GL) --- */

/* Card Component */
.gl-card {
    background-color: var(--card-bg);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative;
    /* For questions with long text */
    word-wrap: break-word; 
}

.gl-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

.gl-card.active {
    border-color: var(--primary);
    border-width: 2px; /* Consistent border width */
    background-color: #e7f1ff; /* Light blue tint */
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.2);
}

/* Card Content Helpers */
.gl-card-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.gl-card-meta {
    font-size: 0.9rem;
    color: #666;
}

.gl-card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
}


/* Side Panel Component */
.gl-panel {
    position: fixed; /* Or part of flex layout depending on parent */
    top: 56px; /* Below navbar */
    right: 0;
    height: calc(100vh - 56px);
    width: 0;
    background-color: var(--panel-bg);
    overflow-y: hidden;
    transition: width 0.3s ease, opacity 0.2s ease;
    padding: 0;
    border-left: 1px solid #dee2e6;
    opacity: 0;
    z-index: 1000;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

body {
    background-color: #f8f9fa;
    padding-top: 60px; /* Fix navbar overlap */
}

/* ... existing styles ... */

.gl-panel-header {
    padding: 20px 30px;
    border-bottom: 1px solid #dee2e6;
    background-color: var(--panel-bg);
}

.gl-panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 600;
}

/* Ensure footer stays at bottom even if content is short */
.gl-panel-footer,
.gl-panel > footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 30px;
    background-color: var(--panel-bg);
    border-top: 1px solid rgba(0,0,0,0.1);
    z-index: 10;
}

.gl-panel-content,
.gl-panel > .edit-section,
.gl-panel > .panel-body-wrapper {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 30px;
    padding-bottom: 90px; /* Space for absolute footer */
    min-height: 0; 
    max-height: 100%;
}

/* Flex-based panel (for split view layouts like questions) */
.gl-panel.flex-panel {
    position: relative;
    top: 0;
    height: auto;
    right: auto;
    box-shadow: none;
}

.gl-panel.active {
    width: min(800px, 70vw);
    opacity: 1;
}

/* Close Button for Panels */
.close-panel {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
    z-index: 10;
}

.close-panel:hover {
    color: #333;
}

/* Notification Container */
#notification-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1050;
    width: 350px;
    pointer-events: none; /* Allow clicks to pass through empty space */
}

#notification-container .alert {
    pointer-events: auto; /* But notifications themselves are clickable */
}

/* Fix for nested panel in Bank View (banco) */
.question-detail-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden; /* Let children handle scroll */
}

/* =========================================
   Index View Specific Styles (Merged)
   ========================================= */

/* Ensure the panel takes full height */
.tests-panel {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: var(--bg-main);
}

/* Styles for content INSIDE the panels (not the panel itself) */
#test-details-content p {
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

#test-details-content strong {
    color: #2c3e50;
    display: inline-block;
    min-width: 100px;
}

/* Button overrides specific to this view if needed */
#panel-details .btn {
    font-weight: 500;
}

/* =========================================
   Refactoring Utilities (Inline Styles)
   ========================================= */

/* Action Buttons (Circular) */
.btn-circle-action {
    width: 50px;
    height: 50px;
    font-size: 24px;
    margin: 0;
}

/* Badge Buttons (Mini helpers) */
.btn-badge {
    padding: 0px 5px;
    font-size: 0.7em;
    vertical-align: middle;
}

/* Report Popover */
.report-popover {
    z-index: 1000;
}
.report-input-group {
    width: 250px;
}

/* Card Images */
.gl-card-image-contain {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Panel Images */
.img-preview-panel {
    max-height: 200px;
}

/* Flex Utilities */
.flex-content-fix {
    flex: 1;
    min-width: 0;
}

/* Animations */
.fade-in-hidden {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.fade-in-visible {
    opacity: 1;
}

/* Navbar Dropdown Override */
.dropdown-menu .dropdown-header {
    color: var(--primary);
    font-weight: 600; /* Optional: make it slightly bolder as headers usually are */
}
