/*
* Nom du fichier : typo_simple_styles.css
* Version : v2 - 27/11/2025
* 
* === NOUVELLES FONCTIONNALITÉS ===
* - Système de recadrage avec poignées
* - Tags pour les mots
* - Contrôles overlay
* - Toggles et sliders améliorés
*/

/* === VARIABLES CSS === */
:root {
    --typo-primary: #1a1a2e;
    --typo-primary-light: #16213e;
    --typo-accent: #e94560;
    --typo-accent-glow: rgba(233, 69, 96, 0.3);
    --typo-secondary: #0f3460;
    --typo-text: #eaeaea;
    --typo-text-muted: #a0a0a0;
    --typo-surface: #1a1a2e;
    --typo-surface-light: #252540;
    --typo-border: #333355;
    --typo-success: #4ade80;
    --typo-radius: 16px;
    --typo-radius-sm: 8px;
    --typo-radius-xs: 4px;
    --typo-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --typo-shadow-glow: 0 0 40px var(--typo-accent-glow);
    --typo-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --typo-font-display: 'Outfit', sans-serif;
    --typo-font-mono: 'JetBrains Mono', monospace;
}

/* === RESET === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--typo-font-display);
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #0f0f1a 100%);
    color: var(--typo-text);
    min-height: 100vh;
    line-height: 1.6;
}

/* === CONTAINER === */
.typo_container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* === HEADER === */
.typo_header {
    text-align: center;
    padding: 60px 20px 40px;
}

.typo_header h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--typo-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.typo_subtitle {
    color: var(--typo-text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

/* === SECTIONS === */
.typo_section {
    background: var(--typo-surface);
    border: 1px solid var(--typo-border);
    border-radius: var(--typo-radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--typo-shadow);
}

.typo_section h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--typo-text);
    margin-bottom: 24px;
}

.typo_section h2 svg {
    color: var(--typo-accent);
}

.typo_hint {
    color: var(--typo-text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* === ZONE UPLOAD === */
.typo_upload_zone {
    border: 2px dashed var(--typo-border);
    border-radius: var(--typo-radius);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--typo-transition);
    background: var(--typo-surface-light);
}

.typo_upload_zone:hover {
    border-color: var(--typo-accent);
    background: rgba(233, 69, 96, 0.05);
}

.typo_upload_zone.dragover {
    border-color: var(--typo-accent);
    background: rgba(233, 69, 96, 0.1);
    box-shadow: var(--typo-shadow-glow);
}

.typo_upload_icon {
    color: var(--typo-accent);
    margin-bottom: 20px;
}

.typo_upload_content h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    justify-content: center;
}

.typo_upload_content p {
    color: var(--typo-text-muted);
    margin-bottom: 24px;
}

/* === CROP SYSTEM === */
.typo_crop_container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 24px;
    background: #000;
    border-radius: var(--typo-radius-sm);
    overflow: hidden;
    touch-action: none;
}

#cropCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.typo_crop_box {
    position: absolute;
    border: 2px solid var(--typo-accent);
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    cursor: move;
    touch-action: none;
}

.typo_crop_handle {
    position: absolute;
    width: 24px;
    height: 24px;
    background: var(--typo-accent);
    border: 3px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
    touch-action: none;
}

.typo_crop_handle_nw {
    top: 0;
    left: 0;
    cursor: nw-resize;
}

.typo_crop_handle_ne {
    top: 0;
    left: 100%;
    cursor: ne-resize;
}

.typo_crop_handle_sw {
    top: 100%;
    left: 0;
    cursor: sw-resize;
}

.typo_crop_handle_se {
    top: 100%;
    left: 100%;
    cursor: se-resize;
}

.typo_crop_controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* === BOUTONS === */
.typo_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--typo-radius-sm);
    font-family: var(--typo-font-display);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--typo-transition);
    text-decoration: none;
}

.typo_btn_primary {
    background: var(--typo-accent);
    color: #fff;
    box-shadow: 0 4px 20px var(--typo-accent-glow);
}

.typo_btn_primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--typo-accent-glow);
}

.typo_btn_secondary {
    background: var(--typo-surface-light);
    color: var(--typo-text);
    border: 1px solid var(--typo-border);
}

.typo_btn_secondary:hover {
    background: var(--typo-secondary);
    border-color: var(--typo-accent);
}

.typo_btn_large {
    padding: 18px 36px;
    font-size: 1.1rem;
}

.typo_btn_icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--typo-surface-light);
    color: var(--typo-text);
    border: 1px solid var(--typo-border);
    border-radius: var(--typo-radius-sm);
    font-family: var(--typo-font-display);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--typo-transition);
}

.typo_btn_icon:hover {
    background: var(--typo-accent);
    border-color: var(--typo-accent);
    color: #fff;
}

.typo_btn_group {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.typo_btn_download {
    background: var(--typo-success);
    color: #000;
    padding: 20px 40px;
    font-size: 1.1rem;
    box-shadow: 0 4px 20px rgba(74, 222, 128, 0.3);
}

.typo_btn_download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(74, 222, 128, 0.4);
}

/* === CONFIG GROUPS === */
.typo_config_group {
    margin-bottom: 28px;
    padding: 20px;
    background: var(--typo-surface-light);
    border-radius: var(--typo-radius-sm);
    border: 1px solid var(--typo-border);
}

.typo_config_advanced {
    background: linear-gradient(135deg, var(--typo-surface-light) 0%, rgba(233, 69, 96, 0.05) 100%);
    border-color: rgba(233, 69, 96, 0.2);
}

.typo_config_label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--typo-text);
    margin-bottom: 12px;
    font-size: 1rem;
}

.typo_config_value {
    margin-left: auto;
    color: var(--typo-accent);
    font-family: var(--typo-font-mono);
    font-weight: 700;
}

.typo_config_hint {
    font-size: 0.85rem;
    color: var(--typo-text-muted);
    margin-top: 8px;
    font-style: italic;
}

/* === SLIDERS === */
.typo_slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--typo-border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 12px 0;
}

.typo_slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--typo-accent);
    cursor: pointer;
    box-shadow: 0 2px 10px var(--typo-accent-glow);
    transition: var(--typo-transition);
}

.typo_slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.typo_slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--typo-accent);
    cursor: pointer;
    border: none;
}

.typo_slider:disabled {
    opacity: 0.5;
}

/* === SELECT === */
.typo_select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--typo-border);
    border-radius: var(--typo-radius-sm);
    background: var(--typo-surface);
    color: var(--typo-text);
    font-family: var(--typo-font-display);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--typo-transition);
}

.typo_select:focus {
    outline: none;
    border-color: var(--typo-accent);
    box-shadow: 0 0 0 3px var(--typo-accent-glow);
}

.typo_select_small {
    width: auto;
    min-width: 150px;
    padding: 10px 14px;
    font-size: 0.9rem;
}

/* === RADIO GROUPS === */
.typo_radio_group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.typo_radio_grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.typo_radio_label {
    display: flex;
    align-items: center;
    padding: 14px;
    background: var(--typo-surface);
    border: 1px solid var(--typo-border);
    border-radius: var(--typo-radius-sm);
    cursor: pointer;
    transition: var(--typo-transition);
}

.typo_radio_label:hover {
    border-color: var(--typo-accent);
    background: rgba(233, 69, 96, 0.05);
}

.typo_radio_label input[type="radio"] {
    margin-right: 12px;
    accent-color: var(--typo-accent);
    width: 18px;
    height: 18px;
}

.typo_radio_label input[type="radio"]:checked+span,
.typo_radio_label input[type="radio"]:checked+.typo_radio_text {
    color: var(--typo-accent);
}

.typo_radio_text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.typo_radio_text strong {
    font-weight: 600;
}

.typo_radio_text code {
    font-family: var(--typo-font-mono);
    font-size: 0.8rem;
    color: var(--typo-text-muted);
}

/* === TOGGLE SWITCH === */
.typo_config_toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 0;
}

.typo_config_toggle input[type="checkbox"] {
    display: none;
}

.typo_toggle_slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--typo-border);
    border-radius: 13px;
    transition: var(--typo-transition);
    flex-shrink: 0;
}

.typo_toggle_slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: var(--typo-transition);
}

.typo_config_toggle input:checked+.typo_toggle_slider {
    background: var(--typo-accent);
}

.typo_config_toggle input:checked+.typo_toggle_slider::after {
    left: 25px;
}

/* === OVERLAY CONTROLS === */
.typo_overlay_controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.typo_slider_inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.typo_slider_inline span {
    font-size: 0.9rem;
    color: var(--typo-text-muted);
    white-space: nowrap;
}

.typo_slider_inline .typo_slider {
    flex: 1;
    margin: 0;
}

/* === TAGS INPUT === */
.typo_words_input {
    margin-top: 12px;
}

.typo_tags_container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: var(--typo-surface);
    border: 1px solid var(--typo-border);
    border-radius: var(--typo-radius-sm);
    min-height: 50px;
    align-items: center;
}

.typo_tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--typo-accent);
    color: #fff;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: tagAppear 0.3s ease;
}

@keyframes tagAppear {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.typo_tag_remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--typo-transition);
}

.typo_tag_remove:hover {
    color: #fff;
}

.typo_tag_input {
    flex: 1;
    min-width: 120px;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--typo-text);
    font-family: var(--typo-font-display);
    font-size: 0.95rem;
    outline: none;
}

.typo_tag_input::placeholder {
    color: var(--typo-text-muted);
}

/* === PREVIEW === */
.typo_preview_wrapper {
    background: #fff;
    border-radius: var(--typo-radius-sm);
    padding: 20px;
    overflow: auto;
    max-height: 600px;
    position: relative;
}

.typo_preview {
    display: inline-block;
    transition: transform 0.3s ease;
    transform-origin: top left;
}

.typo-art-content {
    position: relative;
    display: inline-block;
}

#typoOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-size: 100% 100%;
    background-position: center;
}

.typo_preview_controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

/* === LOADING === */
.typo_loading {
    text-align: center;
    padding: 60px;
}

.typo_spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--typo-border);
    border-top-color: var(--typo-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === DOWNLOAD BOX === */
.typo_download_box {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1) 0%, rgba(74, 222, 128, 0.05) 100%);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: var(--typo-radius);
}

.typo_download_icon {
    color: var(--typo-success);
    margin-bottom: 20px;
}

.typo_download_text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 24px;
}

.typo_download_info {
    margin-top: 16px;
    color: var(--typo-text-muted);
    font-size: 0.9rem;
}

/* === FOOTER === */
.typo_footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--typo-text-muted);
    font-size: 0.85rem;
}

/* === IMAGE PREVIEW DANS UPLOAD === */
.typo_uploaded_preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--typo-radius-sm);
    margin-bottom: 16px;
}

.typo_uploaded_info {
    color: var(--typo-text-muted);
    font-size: 0.9rem;
}