@import "tailwindcss";

/*
 * === ERitors Scribe Design Tokens ===
 *
 * Theme values are defined in :root and overridable via [data-theme].
 * The @theme block references these variables so Tailwind utilities
 * (bg-primary, text-muted, etc.) automatically follow the active theme.
 *
 * COLORS:
 *   Brand ........... primary, primary-dark, primary-light
 *   Surfaces ........ background, dark-background, darkest-background, secondary, tertiary
 *   Semantic surfaces surface-primary, surface-secondary, surface-elevated
 *   Text ............ text-primary, text-secondary, muted, text-dimmed
 *   Semantic ........ success, error, warning, info
 *   Editor .......... editor-text, editor-bold, editor-heading, editor-page-sepia
 *   Scrollbar ....... scrollbar-track, scrollbar-thumb, scrollbar-thumb-hover
 *   Utility ......... glass-bg, surface-gradient-dark, surface-gradient-light
 *   Accents ......... accent-blue, accent-green, accent-orange, accent-purple, accent-red
 *   Interactive ..... interactive, interactive-hover
 *
 * SHADOWS: shadow-feature-hover, shadow-focus-ring
 * FONTS:   font-family-lora, font-family-lora-italic, font-family-adlam
 */

:root, :root[data-theme="dark"] {
    /* Brand */
    --theme-primary: #51AE84;
    --theme-primary-dark: #3A8B69;
    --theme-primary-light: #74C9A0;

    /* Surfaces */
    --theme-secondary: #393B40;
    --theme-tertiary: #26272B;
    --theme-background: #1E1E22;
    --theme-dark-background: #1B1C1F;
    --theme-darkest-background: #191A1C;
    --theme-surface-gradient-dark: #313337;
    --theme-surface-gradient-light: #45474D;
    --theme-glass-bg: rgba(43, 45, 48, 0.7);

    /* Text */
    --theme-text-primary: #F0F0F4;
    --theme-text-secondary: #BCBEC4;
    --theme-muted: #B0B0B0;
    --theme-text-dimmed: #6F737A;

    /* Semantic */
    --theme-success: #28A745;
    --theme-error: #DC3545;
    --theme-warning: #FFC107;
    --theme-info: #17A2B8;

    /* Gray scale */
    --theme-gray: #808388;
    --theme-gray-light: #A0A3A8;
    --theme-gray-dark: #45474D;

    /* Scrollbar */
    --theme-scrollbar-track: #1E1F22;
    --theme-scrollbar-thumb: #51AE84;
    --theme-scrollbar-thumb-hover: #3A8B69;

    /* Editor content */
    --theme-editor-text: #E0E0E4;
    --theme-editor-bold: #F0F0F4;
    --theme-editor-heading: #34acd0;
    --theme-editor-page-sepia: #f4f1e8;

    /* Accents */
    --theme-accent-blue: #5C9CE6;
    --theme-accent-green: #5FB87B;
    --theme-accent-orange: #D4923A;
    --theme-accent-purple: #B07CD8;
    --theme-accent-red: #E06C75;

    /* Shadows */
    --theme-shadow-feature-hover: 0 10px 25px -5px rgba(81, 174, 132, 0.2);
    --theme-shadow-focus-ring: 0 0 0 4px rgba(81, 174, 132, 0.1);
}

/* Light theme — à remplir quand le design sera prêt */
:root[data-theme="light"] {
    --theme-background: #F5F5F5;
    --theme-secondary: #E0E0E0;
    --theme-tertiary: #EBEBEB;
    --theme-dark-background: #D5D5D5;
    --theme-darkest-background: #C0C0C0;
    --theme-surface-gradient-dark: #D0D0D0;
    --theme-surface-gradient-light: #E8E8E8;
    --theme-glass-bg: rgba(240, 240, 240, 0.7);
    --theme-text-primary: #1A1A1A;
    --theme-text-secondary: #555555;
    --theme-muted: #888888;
    --theme-text-dimmed: #999999;
    --theme-scrollbar-track: #E0E0E0;
    --theme-scrollbar-thumb: #51AE84;
    --theme-scrollbar-thumb-hover: #3A8B69;
    --theme-editor-text: #333333;
    --theme-editor-bold: #1A1A1A;
    --theme-editor-heading: #2196B8;
    --theme-editor-page-sepia: #f4f1e8;
    --theme-gray: #999999;
    --theme-gray-light: #BBBBBB;
    --theme-gray-dark: #666666;
    --theme-accent-blue: #3A7BD5;
    --theme-accent-green: #2E8B57;
    --theme-accent-orange: #C47F17;
    --theme-accent-purple: #8B5CC4;
    --theme-accent-red: #C94F5A;
}

@theme {
    /* Brand */
    --color-primary: var(--theme-primary);
    --color-primary-dark: var(--theme-primary-dark);
    --color-primary-light: var(--theme-primary-light);

    /* Surfaces */
    --color-secondary: var(--theme-secondary);
    --color-tertiary: var(--theme-tertiary);
    --color-background: var(--theme-background);
    --color-dark-background: var(--theme-dark-background);
    --color-darkest-background: var(--theme-darkest-background);
    --color-surface-gradient-dark: var(--theme-surface-gradient-dark);
    --color-surface-gradient-light: var(--theme-surface-gradient-light);
    --color-glass-bg: var(--theme-glass-bg);

    /* Semantic surfaces */
    --color-surface-primary: var(--theme-background);
    --color-surface-secondary: var(--theme-secondary);
    --color-surface-elevated: var(--theme-darkest-background);

    /* Text */
    --color-text-primary: var(--theme-text-primary);
    --color-text-secondary: var(--theme-text-secondary);
    --color-muted: var(--theme-muted);
    --color-text-dimmed: var(--theme-text-dimmed);

    /* Semantic */
    --color-success: var(--theme-success);
    --color-error: var(--theme-error);
    --color-warning: var(--theme-warning);
    --color-info: var(--theme-info);

    /* Gray scale */
    --color-gray: var(--theme-gray);
    --color-gray-light: var(--theme-gray-light);
    --color-gray-dark: var(--theme-gray-dark);

    /* Scrollbar */
    --color-scrollbar-track: var(--theme-scrollbar-track);
    --color-scrollbar-thumb: var(--theme-scrollbar-thumb);
    --color-scrollbar-thumb-hover: var(--theme-scrollbar-thumb-hover);

    /* Editor content */
    --color-editor-text: var(--theme-editor-text);
    --color-editor-bold: var(--theme-editor-bold);
    --color-editor-heading: var(--theme-editor-heading);
    --color-editor-page-sepia: var(--theme-editor-page-sepia);

    /* Accents */
    --color-accent-blue: var(--theme-accent-blue);
    --color-accent-green: var(--theme-accent-green);
    --color-accent-orange: var(--theme-accent-orange);
    --color-accent-purple: var(--theme-accent-purple);
    --color-accent-red: var(--theme-accent-red);

    /* Interactive */
    --color-interactive: var(--theme-primary);
    --color-interactive-hover: var(--theme-primary-dark);

    /* Shadows */
    --shadow-feature-hover: var(--theme-shadow-feature-hover);
    --shadow-focus-ring: var(--theme-shadow-focus-ring);

    /* Font Family */
    --font-family-lora: 'Lora', Georgia, serif;
    --font-family-lora-italic: 'Lora Italic', serif;
    --font-family-adlam: 'ADLaM Display', serif;
}

@font-face {
    font-family: 'Lora';
    src: url('../fonts/lora-variable.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Lora Italic';
    src: url('../fonts/lora-Italic.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'ADLaM Display';
    src: url('../fonts/adlam-display.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body {
    background-color: var(--color-background);
}

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--color-scrollbar-track);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-scrollbar-thumb-hover);
}

/* Scrollbar Styles for Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
    animation-delay: 0.3s;
}

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

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes smoothBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.tiptap {
    min-height: calc(100vh - 15rem);
    font-family: 'Lora', sans-serif;
    padding-bottom: 10px;
}

/* Styles pour l'éditeur principal avec classes dynamiques */
.editor-content .tiptap > p:first-child,
.editor-content .tiptap > h1:first-child,
.editor-content .tiptap > h2:first-child,
.editor-content .tiptap > h3:first-child {
    margin-top: 0;
}

.editor-content .tiptap p {
    color: var(--color-editor-text);
    text-indent: 1.25rem;
    overflow-wrap: anywhere;
    margin-top: 0.7em;
    margin-bottom: 0.7em;
}

.no-text-indent .editor-content .tiptap p {
    text-indent: 0;
}


.editor-content .tiptap p strong {
    font-weight: 900;
    color: var(--color-editor-bold);
}

.editor-content .tiptap h1, .editor-content .tiptap h2, .editor-content .tiptap h3 {
    color: var(--color-editor-heading);
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.editor-content .tiptap h1 {
    text-indent: 5px;
    font-size: 1.7em;
}

.editor-content .tiptap h2 {
    text-indent: 3px;
    font-size: 1.4em;
}

.editor-content .tiptap h3 {
    text-indent: 1px;
    font-size: 1.2em;
}

.editor-content .tiptap ul[data-type="bulletList"],
.editor-content .tiptap ol[data-type="orderedList"] {
    text-indent: 0px !important;
}

.editor-content .tiptap li p {
    text-indent: 0px !important;
    margin: 0.2em 0;
}

.ProseMirror-focused {
    outline: none !important;
    border: none !important;
}


.composer-panel-h {
    height: calc(100vh - 8rem);
}

.composer-panel-component-h {
    height: calc(100vh - 14rem);
}

.embla__viewport {
    overflow: hidden;
    width: 100%;
}

.embla__container {
    display: flex;
    gap: 16px;
}

.embla__slide {
    flex: 0 0 18%; /* Changez à 10% pour afficher plus de livres */
    max-width: 200px;
}

.embla__slide img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
}

/* Nouvelles classes pour les cartes de fonctionnalités */
.feature-card {
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    background-color: var(--color-secondary);
    border-radius: 0.75rem;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-feature-hover);
}

.feature-card-bg {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.feature-card:hover .feature-card-bg {
    opacity: 0.2;
}

.feature-icon-container {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-surface-gradient-dark), var(--color-surface-gradient-light));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.feature-card:hover .feature-icon-container {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
}

.feature-title-container {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
}

.feature-title-underline {
    position: absolute;
    bottom: -2px;
    left: 0;
    height: 2px;
    width: 0;
    transition: width 0.3s ease;
}

.feature-card:hover .feature-title-underline {
    width: 100%;
}

.feature-shine-line {
    width: 100%;
    height: 1px;
    background-color: var(--color-surface-gradient-light);
    position: relative;
    overflow: hidden;
}

.feature-shine {
    position: absolute;
    top: 0;
    left: 0;
    height: 1px;
    width: 0;
    transition: width 0.7s ease-out;
}

.feature-card:hover .feature-shine {
    width: 100%;
}

.feature-button {
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.feature-card:hover .feature-button {
    opacity: 1;
    transform: translateY(0);
}

/* Classes pour les cartes de communauté */
.community-card {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    transition: transform 0.3s ease;
}

.community-card:hover {
    transform: translateY(-5px);
}

.community-glow {
    position: absolute;
    inset: -2px;
    opacity: 0.75;
    filter: blur(15px);
    transition: opacity 1s ease, inset 1s ease;
}

.community-card:hover .community-glow {
    opacity: 1;
    inset: -4px;
}

.community-content {
    position: relative;
    padding: 2rem;
    border-radius: 0.75rem;
}

.community-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: var(--color-glass-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

/* Animation pour le statut "En développement" */
@keyframes pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

.dev-status {
    animation: pulse 2s infinite;
}

.last-updated {
    color: var(--color-text-dimmed);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 1rem;
}

.tiptap-draft {
    min-height: auto;
    height: 100%;
    font-family: 'Lora', sans-serif;
}

.tiptap-draft .ProseMirror {
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding: 1rem;
}

.tiptap-draft .ProseMirror em {
    font-family: 'Lora Italic', serif;
    font-style: italic;
}

.tiptap-draft .ProseMirror h1,
.tiptap-draft .ProseMirror h2,
.tiptap-draft .ProseMirror h3 {
    font-family: 'Lora', sans-serif;
    text-indent: 30px;
}

.tiptap-draft p {
    font-family: 'Lora', sans-serif;
    text-indent: 1.25rem;
    overflow-wrap: anywhere;
    margin-top: 0.7em;
    margin-bottom: 0.7em;
}

.no-text-indent .tiptap-draft p {
    text-indent: 0;
}


/* Form input base */
.input-base {
    @apply w-full text-text-primary bg-dark-background px-4 py-2.5 rounded-xl
    border border-secondary
    focus:border-primary focus:ring-4 focus:ring-primary/20
    placeholder:text-muted
    outline-none transition-all duration-200;
}

.input-base:disabled {
    @apply opacity-50 cursor-not-allowed;
}

.input-base[readonly] {
    @apply cursor-default;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Smooth transitions for all interactive elements */
button, a, input, textarea, select {
    transition: all 0.2s ease-in-out;
}

/* Enhanced focus states */
button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: var(--shadow-focus-ring);
}

/* Smooth hover scale for interactive elements */
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Literary decorative elements */
.literary-ornament::before,
.literary-ornament::after {
    content: "❖";
    color: var(--color-primary);
    opacity: 0.3;
    font-size: 0.8em;
    margin: 0 0.5em;
}

/* Subtle pulse for active states */
@keyframes subtlePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.pulse-subtle {
    animation: subtlePulse 2s ease-in-out infinite;
}

/* Glass morphism effect */
.glass-effect {
    background: var(--color-glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-surface-gradient-light);
}

/* Fade in pour le texte qui stream */
.fade-in-text {
    animation: textFadeIn 100ms ease-out;
}

@keyframes textFadeIn {
    from {
        opacity: 0.7;
    }
    to {
        opacity: 1;
    }
}

/* Alert animations */
@keyframes shrink {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

.alert-progress-shrink {
    animation: shrink 5s linear forwards;
    width: 100%;
}

.alert-slide-in {
    animation: slideInFromRight 0.3s ease-out forwards;
}

/* Pulse dots for loading indicators */
.pulse-dot-1 {
    animation-delay: 0ms;
    animation-duration: 1.5s;
}

.pulse-dot-2 {
    animation-delay: 300ms;
    animation-duration: 1.5s;
}

.pulse-dot-3 {
    animation-delay: 600ms;
    animation-duration: 1.5s;
}
