/**
 * Styles pour le shortcode Créer
 * Design moderne type Google Docs/Sheets/Slides
 */

/* === VARIABLES === */
:root {
    --sp-creer-primary: #007aff;
    --sp-creer-primary-hover: #0051d5;
    --sp-creer-secondary: #8e8e93;
    --sp-creer-success: #34c759;
    --sp-creer-danger: #ff3b30;
    --sp-creer-warning: #ff9500;
    
    --sp-creer-bg: #ffffff;
    --sp-creer-bg-secondary: #f5f5f7;
    --sp-creer-bg-tertiary: #e8e8ed;
    --sp-creer-card-bg: #ffffff;
    --sp-creer-border: #d1d1d6;
    --sp-creer-text: #000000;
    --sp-creer-text-secondary: #6e6e73;
    --sp-creer-shadow: rgba(0, 0, 0, 0.1);
    --sp-creer-shadow-lg: rgba(0, 0, 0, 0.15);
    
    --sp-creer-radius: 12px;
    --sp-creer-radius-sm: 8px;
    --sp-creer-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --sp-creer-bg: #000000;
    --sp-creer-bg-secondary: #1c1c1e;
    --sp-creer-bg-tertiary: #2c2c2e;
    --sp-creer-card-bg: #1c1c1e;
    --sp-creer-border: #38383a;
    --sp-creer-text: #ffffff;
    --sp-creer-text-secondary: #98989d;
    --sp-creer-shadow: rgba(0, 0, 0, 0.3);
    --sp-creer-shadow-lg: rgba(0, 0, 0, 0.4);
}

/* === CONTENEUR PRINCIPAL === */
.sp-creer-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--sp-creer-bg);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    position: relative;
    overflow: hidden;
}

/* === PAGE D'ACCUEIL === */
.sp-creer-home {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

.sp-creer-header {
    margin-bottom: 60px;
}

.sp-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sp-logo svg {
    width: 48px;
    height: 48px;
    color: var(--sp-creer-primary);
    stroke-width: 2;
}

.sp-logo h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--sp-creer-text);
    margin: 0;
}

.sp-creer-welcome {
    text-align: center;
    margin-bottom: 80px;
}

.sp-creer-welcome h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--sp-creer-text);
    margin: 0 0 12px 0;
}

.sp-creer-welcome p {
    font-size: 18px;
    color: var(--sp-creer-text-secondary);
    margin: 0 0 48px 0;
}

/* === TYPES DE DOCUMENTS === */
.sp-document-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.sp-doc-type-card {
    position: relative;
    padding: 48px 32px;
    background: var(--sp-creer-card-bg);
    border: 2px solid var(--sp-creer-border);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--sp-creer-transition);
    text-align: center;
    overflow: hidden;
}

.sp-doc-type-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--sp-creer-primary) 0%, transparent 100%);
    opacity: 0;
    transition: var(--sp-creer-transition);
}

.sp-doc-type-card:hover {
    border-color: var(--sp-creer-primary);
    transform: translateY(-8px);
    box-shadow: 0 16px 40px var(--sp-creer-shadow-lg);
}

.sp-doc-type-card:hover::before {
    opacity: 0.05;
}

.sp-doc-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sp-creer-primary), #00d4ff);
    border-radius: 20px;
    position: relative;
    z-index: 1;
}

.sp-doc-icon svg {
    width: 48px;
    height: 48px;
    color: #ffffff;
    stroke-width: 2;
}

.sp-doc-type-card h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--sp-creer-text);
    margin: 0 0 8px 0;
    position: relative;
    z-index: 1;
}

.sp-doc-type-card p {
    font-size: 16px;
    color: var(--sp-creer-text-secondary);
    margin: 0;
    position: relative;
    z-index: 1;
}

/* === DOCUMENTS RÉCENTS === */
.sp-recent-documents {
    max-width: 1200px;
    margin: 0 auto;
}

.sp-recent-documents h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--sp-creer-text);
    margin: 0 0 24px 0;
}

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

.sp-recent-item {
    padding: 20px;
    background: var(--sp-creer-card-bg);
    border: 1px solid var(--sp-creer-border);
    border-radius: var(--sp-creer-radius);
    cursor: pointer;
    transition: var(--sp-creer-transition);
}

.sp-recent-item:hover {
    background: var(--sp-creer-bg-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--sp-creer-shadow);
}

.sp-recent-item-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
}

.sp-recent-item-icon svg {
    width: 100%;
    height: 100%;
    color: var(--sp-creer-primary);
}

.sp-recent-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--sp-creer-text);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-recent-item-meta {
    font-size: 12px;
    color: var(--sp-creer-text-secondary);
}

/* === ÉDITEUR === */
.sp-editor {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* === TOOLBAR SUPÉRIEURE === */
.sp-toolbar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--sp-creer-card-bg);
    border-bottom: 1px solid var(--sp-creer-border);
    z-index: 100;
}

.sp-toolbar-left,
.sp-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sp-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--sp-creer-radius-sm);
    color: var(--sp-creer-text);
    cursor: pointer;
    transition: var(--sp-creer-transition);
    position: relative;
}

.sp-btn-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.sp-btn-icon:hover {
    background: var(--sp-creer-bg-secondary);
}

.sp-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--sp-creer-danger);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === TITRE DU DOCUMENT === */
.sp-document-title-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sp-document-title {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--sp-creer-radius-sm);
    color: var(--sp-creer-text);
    font-size: 16px;
    font-weight: 500;
    outline: none;
    min-width: 200px;
    transition: var(--sp-creer-transition);
}

.sp-document-title:hover {
    background: var(--sp-creer-bg-secondary);
}

.sp-document-title:focus {
    background: var(--sp-creer-bg);
    border-color: var(--sp-creer-primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.sp-save-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--sp-creer-text-secondary);
}

.sp-save-status.saving {
    color: var(--sp-creer-warning);
}

.sp-save-status.saved {
    color: var(--sp-creer-success);
}

.sp-icon-check {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* === COLLABORATEURS === */
.sp-collaborators {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sp-creer-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sp-creer-transition);
}

.sp-avatar:hover {
    transform: scale(1.1);
}

/* === DROPDOWN === */
.sp-dropdown {
    position: relative;
}

.sp-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--sp-creer-card-bg);
    border: 1px solid var(--sp-creer-border);
    border-radius: var(--sp-creer-radius);
    box-shadow: 0 8px 24px var(--sp-creer-shadow-lg);
    padding: 8px;
    z-index: 1000;
    animation: sp-fadeIn 0.2s ease-out;
}

@keyframes sp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sp-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--sp-creer-text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: var(--sp-creer-transition);
}

.sp-dropdown-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.sp-dropdown-item:hover {
    background: var(--sp-creer-bg-secondary);
}

.sp-dropdown-item.sp-danger {
    color: var(--sp-creer-danger);
}

.sp-dropdown-divider {
    height: 1px;
    background: var(--sp-creer-border);
    margin: 8px 0;
}

/* === TOOLBAR DE FORMATAGE === */
.sp-toolbar-format {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--sp-creer-card-bg);
    border-bottom: 1px solid var(--sp-creer-border);
    overflow-x: auto;
}

.sp-toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sp-toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--sp-creer-border);
    margin: 0 8px;
}

.sp-format-select {
    padding: 6px 12px;
    background: var(--sp-creer-bg-secondary);
    border: 1px solid var(--sp-creer-border);
    border-radius: 6px;
    color: var(--sp-creer-text);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: var(--sp-creer-transition);
}

.sp-format-select:hover {
    background: var(--sp-creer-bg-tertiary);
}

.sp-format-select:focus {
    border-color: var(--sp-creer-primary);
}

.sp-format-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--sp-creer-text);
    cursor: pointer;
    transition: var(--sp-creer-transition);
    position: relative;
}

.sp-format-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.sp-format-btn:hover {
    background: var(--sp-creer-bg-secondary);
}

.sp-format-btn.active {
    background: var(--sp-creer-primary);
    color: #ffffff;
}

.sp-color-picker {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 4px;
    border: none;
    cursor: pointer;
    opacity: 0;
}

/* === ZONE D'ÉDITION === */
.sp-editor-area {
    flex: 1;
    overflow: hidden;
    background: var(--sp-creer-bg-secondary);
}

/* === ÉDITEUR QUILL === */
#sp-quill-editor {
    height: 100%;
    background: var(--sp-creer-bg);
    max-width: 900px;
    margin: 40px auto;
    padding: 40px 60px;
    box-shadow: 0 2px 8px var(--sp-creer-shadow);
}

.ql-container {
    font-family: inherit;
    font-size: 14px;
    height: calc(100% - 42px);
}

.ql-editor {
    padding: 0;
    min-height: 100%;
}

/* === TABLEUR === */
.sp-spreadsheet-toolbar {
    padding: 12px 16px;
    background: var(--sp-creer-card-bg);
    border-bottom: 1px solid var(--sp-creer-border);
}

.sp-spreadsheet-container {
    flex: 1;
    overflow: auto;
    background: var(--sp-creer-bg);
}

.sp-sheet-table {
    border-collapse: collapse;
    background: var(--sp-creer-bg);
}

.sp-sheet-cell {
    min-width: 100px;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--sp-creer-border);
    font-size: 13px;
    color: var(--sp-creer-text);
    outline: none;
}

.sp-sheet-cell:focus {
    border-color: var(--sp-creer-primary);
    box-shadow: inset 0 0 0 1px var(--sp-creer-primary);
}

.sp-sheet-header {
    background: var(--sp-creer-bg-secondary);
    font-weight: 600;
    text-align: center;
}

.sp-sheet-tabs {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    background: var(--sp-creer-card-bg);
    border-top: 1px solid var(--sp-creer-border);
}

.sp-sheet-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--sp-creer-text);
    font-size: 13px;
    cursor: pointer;
    transition: var(--sp-creer-transition);
}

.sp-sheet-tab:hover {
    background: var(--sp-creer-bg-secondary);
}

.sp-sheet-tab.active {
    background: var(--sp-creer-primary);
    color: #ffffff;
}

/* === PRÉSENTATION === */
#sp-editor-presentation {
    display: flex;
    height: 100%;
}

.sp-presentation-sidebar {
    width: 250px;
    padding: 16px;
    background: var(--sp-creer-card-bg);
    border-right: 1px solid var(--sp-creer-border);
    overflow-y: auto;
}

.sp-slides-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sp-slide-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--sp-creer-bg);
    border: 2px solid var(--sp-creer-border);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--sp-creer-transition);
}

.sp-slide-thumb:hover {
    border-color: var(--sp-creer-primary);
}

.sp-slide-thumb.active {
    border-color: var(--sp-creer-primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.sp-slide-number {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

.sp-presentation-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow: auto;
}

.sp-slide-canvas {
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16/9;
    background: var(--sp-creer-bg);
    border-radius: 8px;
    box-shadow: 0 4px 16px var(--sp-creer-shadow-lg);
}

/* === PANELS LATÉRAUX === */
.sp-comments-panel,
.sp-history-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: var(--sp-creer-card-bg);
    border-left: 1px solid var(--sp-creer-border);
    box-shadow: -4px 0 12px var(--sp-creer-shadow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: sp-slideInRight 0.3s ease-out;
}

@keyframes sp-slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.sp-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--sp-creer-border);
}

.sp-panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--sp-creer-text);
    margin: 0;
}

.sp-panel-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.sp-comment-item {
    padding: 16px;
    background: var(--sp-creer-bg-secondary);
    border-radius: var(--sp-creer-radius-sm);
    margin-bottom: 12px;
}

.sp-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sp-comment-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--sp-creer-text);
}

.sp-comment-time {
    font-size: 12px;
    color: var(--sp-creer-text-secondary);
}

.sp-comment-content {
    font-size: 14px;
    color: var(--sp-creer-text);
    line-height: 1.6;
}

.sp-comment-form {
    margin-top: 20px;
}

.sp-comment-input {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    background: var(--sp-creer-bg-secondary);
    border: 1px solid var(--sp-creer-border);
    border-radius: var(--sp-creer-radius-sm);
    color: var(--sp-creer-text);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: var(--sp-creer-transition);
    margin-bottom: 12px;
}

.sp-comment-input:focus {
    border-color: var(--sp-creer-primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* === VERSIONS === */
.sp-version-item {
    padding: 16px;
    background: var(--sp-creer-bg-secondary);
    border-radius: var(--sp-creer-radius-sm);
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--sp-creer-transition);
}

.sp-version-item:hover {
    background: var(--sp-creer-bg-tertiary);
}

.sp-version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.sp-version-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--sp-creer-text);
}

.sp-version-time {
    font-size: 12px;
    color: var(--sp-creer-text-secondary);
}

.sp-version-author {
    font-size: 13px;
    color: var(--sp-creer-text-secondary);
}

/* === BOUTONS === */
.sp-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--sp-creer-primary);
    border: none;
    border-radius: var(--sp-creer-radius-sm);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sp-creer-transition);
    width: 100%;
    justify-content: center;
}

.sp-btn-primary:hover {
    background: var(--sp-creer-primary-hover);
    transform: translateY(-2px);
}

.sp-btn-primary svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* === LOADING === */
.sp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--sp-creer-text-secondary);
}

.sp-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--sp-creer-border);
    border-top-color: var(--sp-creer-primary);
    border-radius: 50%;
    animation: sp-spin 0.8s linear infinite;
}

@keyframes sp-spin {
    to { transform: rotate(360deg); }
}

.sp-loading p {
    margin-top: 16px;
    font-size: 14px;
}

/* === TOAST === */
.sp-toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 10001;
    animation: sp-toastSlideUp 0.3s ease-out;
}

@keyframes sp-toastSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sp-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--sp-creer-card-bg);
    border: 1px solid var(--sp-creer-border);
    border-radius: var(--sp-creer-radius);
    box-shadow: 0 8px 24px var(--sp-creer-shadow-lg);
    min-width: 300px;
}

.sp-toast-icon {
    width: 20px;
    height: 20px;
    stroke: var(--sp-creer-success);
    stroke-width: 2.5;
    flex-shrink: 0;
}

.sp-toast.error .sp-toast-icon {
    stroke: var(--sp-creer-danger);
}

.sp-toast-message {
    color: var(--sp-creer-text);
    font-size: 14px;
    font-weight: 500;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sp-creer-home {
        padding: 20px;
    }
    
    .sp-document-types {
        grid-template-columns: 1fr;
    }
    
    .sp-toolbar-format {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .sp-comments-panel,
    .sp-history-panel {
        width: 100%;
    }
    
    #sp-quill-editor {
        margin: 20px;
        padding: 20px 30px;
    }
    
    .sp-presentation-sidebar {
        width: 200px;
    }
}