/* presentation_editor_ui.css - Boutons, toolbar, modals, formulaires */
/* Version 60 */

/* ==================== BOUTONS ==================== */

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    color: white;
}

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

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

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

.btn-success:hover {
    background: #218838;
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-tool {
    padding: 0.5rem 1rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: #333;
}

.btn-tool:hover {
    background: #e9ecef;
}

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

/* ==================== BOUTONS ICÔNES (NOUVEAUX) ==================== */

.btn-icon {
    padding: 0.5rem 0.75rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    position: relative;
}

.btn-icon:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.btn-icon:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    margin-bottom: 0.5rem;
    z-index: 1000;
}

.btn-danger-icon {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

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

/* ==================== BOUTONS DE NAVIGATION ICÔNES ==================== */

.btn-nav-icon {
    padding: 0.4rem 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-nav-icon:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.btn-nav-icon:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ==================== BOUTONS DE NAVIGATION (ANCIENS) ==================== */

.btn-nav {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-nav:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-nav:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-reorder {
    padding: 0.4rem 0.8rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-reorder:hover:not(:disabled) {
    background: #e9ecef;
}

.btn-reorder:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== SÉPARATEUR TOOLBAR ==================== */

.toolbar-separator {
    width: 1px;
    height: 30px;
    background: var(--border);
    margin: 0 0.5rem;
}

/* ==================== MENUS DÉROULANTS ==================== */

.theme-selector,
.style-selector {
    position: relative;
}

.theme-menu,
.style-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
    margin-top: 0.25rem;
}

.theme-menu.show,
.style-menu.show {
    display: block;
}

.theme-menu button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    color: #333;
    font-size: 0.9rem;
}

.theme-menu button:hover {
    background: var(--light);
}

/* ==================== MENU DISPOSITION IMAGE ==================== */

.img-layout-selector {
    position: relative;
}

.img-layout-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 260px;
    z-index: 1000;
    margin-top: 0.25rem;
}

.img-layout-menu.show {
    display: block;
}

.img-layout-menu button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    color: #333;
    font-size: 0.9rem;
    white-space: nowrap;
}

.img-layout-menu button:hover {
    background: var(--light);
}

/* ==================== MENU DES STYLES ==================== */

.style-menu {
    min-width: 350px;
    max-width: 400px;
    max-height: 500px;
    overflow-y: auto;
}

.style-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.style-option:last-child {
    border-bottom: none;
}

.style-option:hover {
    background: #f8f9fa;
}

.style-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.style-info {
    flex: 1;
}

.style-info strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: #333;
}

.style-info small {
    display: block;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

/* ==================== SÉLECTEURS DE COULEURS ==================== */

#textColorPicker,
#bgColorPicker {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* ==================== MODALS ==================== */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #999;
    cursor: pointer;
    border: none;
    background: none;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

/* ==================== TEMPLATE GRID ==================== */

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.template-item {
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s;
}

.template-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.template-preview {
    width: 100%;
    aspect-ratio: 16/9;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.template-item p {
    font-weight: 600;
    color: #666;
    margin: 0;
}

/* ==================== FORMULAIRES ==================== */

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group select {
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.875rem;
}

.form-group small a {
    color: var(--primary-color);
}

/* ==================== BARRE DE PROGRESSION ==================== */

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* ==================== MODE PRÉSENTATION ==================== */

.presentation-mode {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    z-index: 9999;
}

.presentation-mode.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.presentation-slide {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.presentation-slide .slide {
    width: 90vw;
    height: 90vh;
    max-width: 1920px;
    max-height: 1080px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.presentation-controls {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    background: rgba(0,0,0,0.7);
    padding: 1rem;
    border-radius: 8px;
}

.btn-pres {
    padding: 0.75rem 1.5rem;
    background: white;
    color: black;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-pres:hover:not(:disabled) {
    background: #e9ecef;
}

.btn-pres:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-pres.btn-exit:hover {
    background: #c82333;
}

.presentation-progress {
    display: flex;
    align-items: center;
    color: white;
    font-weight: 600;
    padding: 0 1rem;
}

.nav-overlay {
    position: fixed;
    top: 0;
    width: 30%;
    height: 100%;
    cursor: pointer;
    z-index: 10;
}

.nav-overlay.left {
    left: 0;
}

.nav-overlay.right {
    right: 0;
}

/* -------------------------------------- */

/* Template Grid V2 */
.template-category {
    margin-bottom: 1.5rem;
}

.template-category h3 {
    margin: 1rem 0 0.5rem 0;
    color: #333;
    font-size: 0.9rem;
    font-weight: 600;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.25rem;
}

.template-item {
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s;
    background: white;
}

.template-item:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
}

.template-preview {
    background: #f8f9fa;
    border-radius: 4px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.template-item p {
    margin: 0.25rem 0;
    text-align: center;
}

/* Bouton de dictée vocale */
.btn-voice {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 40px;
    height: 40px;
    border: none;
    background: #007bff;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 10;
}

.btn-voice:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.btn-voice.recording {
    background: #dc3545;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.form-group textarea {
    padding-right: 60px; /* Espace pour le bouton */
}

/* Slider de redimensionnement d'image */
#imageSizeRange {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: linear-gradient(to right, #28a745, #007bff, #ffc107);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

#imageSizeRange::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #007bff;
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

#imageSizeRange::-webkit-slider-thumb:hover {
    background: #0056b3;
    transform: scale(1.1);
}

#imageSizeRange::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #007bff;
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

#imageSizeRange::-moz-range-thumb:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.image-preview-container {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
}

