/* ================================
   CSS COMMUN POUR LE PROJET RENARDEAU
   Extrait de create.html et réorganisé
   ================================ */

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Typography et Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
}

/* Layout Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-height: 100vh;
}

/* ================================
   MENU BAR COMPONENTS
   ================================ */
.menu-bar {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
    display: flex;
    align-items: center;
    height: 40px;
    position: relative;
    z-index: 100;
}

.menu-item {
    position: relative;
    display: inline-block;
}

.menu-button {
    background: none;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    border-radius: 0;
    transition: background-color 0.2s;
}

.menu-button:hover {
    background: #e8e8e8;
}

.menu-button.active {
    background: #007acc;
    color: white;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: none;
    min-width: 180px;
    z-index: 1000;
}

.dropdown-item {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #e8e8e8;
}

.dropdown-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* ================================
   HEADER COMPONENTS
   ================================ */
.header {
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
    padding: 20px 30px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 400;
    color: #333;
    margin: 0;
}

/* ================================
   BUTTON COMPONENTS
   ================================ */
.btn {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: #f8f8f8;
    color: #333;
    text-decoration: none;
}

.btn:hover {
    background: #e8e8e8;
    border-color: #999;
}

.btn[title] {
    position: relative;
}

.btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

/* Button variants pour les pages d'authentification */
.btn-primary {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 12px 24px;
    font-size: 14px;
    border: none;
    margin: 10px 5px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Button secondary pour les alternatives */
.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    font-size: 13px;
    border: 1px solid #6c757d;
    margin: 5px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #545b62;
    border-color: #545b62;
    transform: translateY(-1px);
}

/* Button link pour les actions secondaires */
.btn-link {
    background: transparent;
    color: #007acc;
    padding: 8px 16px;
    font-size: 12px;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-link:hover {
    color: #005a9e;
    background: rgba(0, 122, 204, 0.05);
}

/* ================================
   LOGIN FORM COMPONENTS
   ================================ */
.login-form {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-form .form-group {
    margin-bottom: 15px;
    text-align: left;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.1);
}

.form-actions {
    text-align: center;
    margin-top: 20px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 5px;
    border-left: 4px solid #dc3545;
    margin-top: 15px;
    font-size: 13px;
}

.login-error .error-content {
    text-align: left;
}

.login-alternatives {
    margin-top: 25px;
    text-align: center;
}

.divider {
    margin: 20px 0;
    position: relative;
    text-align: center;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

.divider span {
    background: #f8f9fa;
    padding: 0 15px;
    color: #666;
    font-size: 12px;
    position: relative;
    z-index: 1;
}

/* Spinner pour le bouton de connexion */
.btn-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* États des boutons */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ================================
   CONTENT AREA
   ================================ */
.content {
    padding: 30px;
}

/* ================================
   QUESTION GROUP COMPONENTS
   ================================ */
.question-group {
    background: #fff;
    border: 1px solid #e0e0e0;
    margin-bottom: 6px;
    padding: 0;
}

.question-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
}

.question-group-header .btn {
    padding: 4px 6px;
    min-width: 24px;
    height: 24px;
    font-size: 11px;
    margin-left: 4px;
}

.question-group-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.question-group-title:hover {
    background-color: #f8f9fa;
    border-color: #ccc !important;
}

.question-group-title:focus {
    background-color: #fff;
    border-color: #007bff !important;
}

.question-group-content {
    padding: 0;
}

.question-item {
    background: white;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-item:hover {
    background: #f8f8f8;
}

.question-item:last-child {
    border-bottom: none;
}

.question-content {
    flex: 1;
}

.question-points {
    display: flex;
    gap: 4px;
    margin-left: 15px;
}

.point-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

.point-badge.correct {
    background: linear-gradient(135deg, #28a745, #34ce57);
    border: 1px solid #1e7e34;
}

.point-badge.incorrect {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    border: 1px solid #bd2130;
}

.point-badge.no-answer {
    background: linear-gradient(135deg, #ffc107, #ffcd39);
    border: 1px solid #d39e00;
    color: #212529;
    text-shadow: none;
}

.question-preview {
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 4px;
    color: #333;
}

.question-type {
    font-size: 11px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 2px;
    display: inline-block;
}

.question-answer {
    font-size: 12px;
    color: #007acc;
    margin-top: 4px;
}

/* ================================
   GRADING SCALE COMPONENTS
   ================================ */
.grading-scale {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.grading-canvas-container {
    position: relative;
    width: 100%;
    height: 120px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin: 15px 0;
}

#gradingCanvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    display: block;
}

.grading-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 0 10px;
    font-size: 12px;
    color: #6c757d;
}

.grading-instructions {
    font-size: 11px;
    color: #6c757d;
    margin-top: 8px;
    text-align: center;
    font-style: italic;
}

.reset-grading-btn {
    padding: 4px 8px !important;
    font-size: 11px !important;
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 3px !important;
    color: #666 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.reset-grading-btn:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
    color: #495057 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.reset-grading-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ================================
   MODAL COMPONENTS
   ================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid #ccc;
}

.modal-header {
    background: #f8f8f8;
    color: #333;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 4px 4px 0 0;
}

.modal-header h2,
.modal-header h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.modal-body {
    padding: 20px;
}

/* ================================
   FORM COMPONENTS
   ================================ */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 400;
    font-size: 13px;
    color: #666;
}

.form-control {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007acc;
}

/* ================================
   CHOICE COMPONENTS (for question editor)
   ================================ */
.choice-item {
    margin-bottom: 8px;
    padding: 8px;
    background: #fafafa;
    border-radius: 3px;
    border: 1px solid #e0e0e0;
}

.choice-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.choice-content {
    margin-left: 20px;
}

.choice-type-selector {
    display: flex;
    gap: 2px;
    margin-bottom: 6px;
}

.choice-type-btn {
    padding: 3px 6px;
    background: #e8e8e8;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 10px;
}

.choice-type-btn.active {
    background: #007acc;
    color: white;
}

.choice-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 2px;
    margin-bottom: 6px;
    font-size: 12px;
}

.choice-code-editor {
    width: 100%;
    font-family: 'Consolas', 'Courier New', monospace;
    background: #f8f8f8;
    color: #333;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 2px;
    min-height: 60px;
    font-size: 11px;
    line-height: 1.3;
}

.choice-image-upload {
    display: flex;
    align-items: center;
    gap: 6px;
}

.choice-image-upload input[type="file"] {
    flex: 1;
    font-size: 11px;
}

.choice-image-preview {
    max-width: 60px;
    max-height: 40px;
    border-radius: 2px;
}

.choice-code-container {
    border: 1px solid #ccc;
    border-radius: 3px;
    overflow: hidden;
}

.choice-code-container .CodeMirror {
    height: 80px;
    font-size: 11px;
    line-height: 1.3;
}

.choice-code-container .CodeMirror-scroll {
    min-height: 60px;
}

/* ================================
   CODE EDITOR COMPONENTS
   ================================ */
.code-editor-container {
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.code-editor-toolbar {
    background: #f8f8f8;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
}

.code-editor-toolbar button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
}

.code-editor-toolbar button:hover {
    background: #e8e8e8;
}

/* CodeMirror Styles */
.CodeMirror {
    height: 400px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.CodeMirror-focused {
    outline: none;
}

/* ================================
   TAB COMPONENTS
   ================================ */
.tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.tab {
    padding: 8px 16px;
    cursor: pointer;
    border: none;
    background: none;
    font-weight: 400;
    font-size: 13px;
    color: #666;
    transition: all 0.2s ease;
}

.tab.active {
    color: #007acc;
    border-bottom: 2px solid #007acc;
    background: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ================================
   EMPTY STATE
   ================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    background: #fafafa;
}

.empty-state h3 {
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 400;
    color: #666;
}

.empty-state p {
    font-size: 13px;
    color: #999;
}

/* ================================
   DRAG AND DROP
   ================================ */
.drag-drop-area {
    border: 1px dashed #ccc;
    border-radius: 3px;
    padding: 12px;
    text-align: center;
    margin: 6px 0;
    transition: all 0.2s ease;
    font-size: 12px;
    color: #666;
}

.drag-drop-area:hover {
    border-color: #007acc;
    background: #f8f9fa;
}

/* ================================
   CONTEXT MENU
   ================================ */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1001;
    min-width: 150px;
    padding: 5px 0;
    display: none;
}

.context-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #f8f9fa;
}

.context-menu-item.danger {
    color: #dc3545;
}

.context-menu-item.danger:hover {
    background-color: #f8d7da;
}

/* ================================
   POINTS SLIDER COMPONENTS
   ================================ */
.points-slider-container {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-width: 110px;
}

.points-slider-input {
    width: 70px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.points-slider-input.correct {
    background: linear-gradient(to right, #c3e6c3 0%, #d4edda 100%);
}

.points-slider-input.incorrect {
    background: linear-gradient(to right, #f5c6c6 0%, #f8d7da 100%);
}

.points-slider-input.no-answer {
    background: linear-gradient(to right, #ffe082 0%, #fff3cd 100%);
}

/* Thumb WebKit */
.points-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.points-slider-input.correct::-webkit-slider-thumb {
    background: #28a745;
}

.points-slider-input.incorrect::-webkit-slider-thumb {
    background: #dc3545;
}

.points-slider-input.no-answer::-webkit-slider-thumb {
    background: #ffc107;
}

.points-slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* Thumb Firefox */
.points-slider-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.points-slider-input.correct::-moz-range-thumb {
    background: #28a745;
}

.points-slider-input.incorrect::-moz-range-thumb {
    background: #dc3545;
}

.points-slider-input.no-answer::-moz-range-thumb {
    background: #ffc107;
}

.points-slider-input::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* Track Firefox */
.points-slider-input::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    border: none;
}

.points-value-display {
    font-size: 11px;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
    padding: 2px 4px;
    border-radius: 3px;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.points-value-display.correct {
    background: #28a745;
}

.points-value-display.incorrect {
    background: #dc3545;
}

.points-value-display.no-answer {
    background: #ffc107;
    color: #333;
    text-shadow: none;
}

/* ================================
   AUTHENTICATION PAGES STYLES
   ================================ */
.auth-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.auth-body {
    background: linear-gradient(135deg, #ecf0f1 0%, #bdc3c7 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 50%;
    margin: 0 auto 20px;
    margin-top: 12px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #666;
    font-size: 14px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #34495e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #c33;
}

.login-message {
    background: #fff3cd;
    color: #856404;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #ffc107;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #28a745;
}

.user-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
    text-align: left;
}

.user-info strong {
    color: #495057;
}

.welcome-message {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.welcome-message h2 {
    color: #333;
    margin-bottom: 15px;
}

.welcome-message p {
    color: #666;
    font-size: 16px;
}

.coming-soon {
    background: #fff3cd;
    color: #856404;
    padding: 20px;
    border-radius: 5px;
    border-left: 4px solid #ffc107;
}

/* ================================
   UTILITY CLASSES
   ================================ */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .container {
        margin: 0;
        box-shadow: none;
    }
    
    .header {
        padding: 15px 20px;
    }
    
    .content {
        padding: 20px;
    }
    
    .auth-container {
        width: 95%;
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.2rem;
    }
    
    .question-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .question-points {
        margin-left: 0;
    }
}