@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Uncial+Antiqua&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    --bg-color: #050000;
    --sidebar-bg: #1a0a0a;
    --panel-bg: #2a1010;
    --accent-gold: #cba052;
    --accent-red: #8a0303;
    --text-light: #eeddcc;
    --paper-bg: #eaddc5;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at center, #1a0505 0%, #050000 100%);
    font-family: 'Cinzel', serif;
    color: var(--text-light);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* =========================================
   PAGE DE LOGIN / CHARGEMENT (index.php)
   ========================================= */
.login-body {
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background-image: linear-gradient(rgba(5, 0, 0, 0.8), rgba(15, 0, 0, 0.9)), url('https://www.transparenttextures.com/patterns/black-scales.png');
}

#loading-screen {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle at center, #1a0000 0%, #000000 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 1s ease;
}

.blood-drop {
    width: 40px; height: 40px;
    background-color: var(--accent-red);
    border-radius: 0 50% 50% 50%;
    transform: rotate(45deg);
    animation: drip 2s infinite ease-in-out;
    margin-bottom: 30px;
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.5), 0 0 15px var(--accent-red);
}

@keyframes drip {
    0% { transform: rotate(45deg) scale(0.8) translateY(-20px); opacity: 0.5; }
    50% { transform: rotate(45deg) scale(1.2) translateY(0); opacity: 1; }
    100% { transform: rotate(45deg) scale(0.8) translateY(20px); opacity: 0; }
}

.loading-title {
    font-family: 'Uncial Antiqua', cursive;
    font-size: 45px;
    color: var(--accent-red);
    text-shadow: 0 0 15px rgba(138, 3, 3, 0.8);
    letter-spacing: 3px;
    text-align: center;
}

.loading-text {
    color: var(--accent-gold);
    font-size: 18px;
    margin-top: 20px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.login-box {
    background: rgba(20, 5, 5, 0.95);
    border: 2px solid var(--accent-gold);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,1), inset 0 0 20px rgba(138, 3, 3, 0.2);
    text-align: center;
    width: 90%;
    max-width: 400px;
    display: none;
    opacity: 0;
    transition: opacity 1s ease;
}

.login-box h2 {
    font-family: 'Uncial Antiqua', cursive;
    color: var(--accent-red);
    margin-bottom: 30px;
    font-size: 32px;
}

.login-box input {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    background: rgba(0,0,0,0.8);
    border: 1px solid #4a2a2a;
    color: var(--text-light);
    font-family: 'Cinzel', serif;
    font-size: 16px;
    box-sizing: border-box;
    transition: 0.3s;
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 15px rgba(138, 3, 3, 0.5);
}

.login-box button {
    width: 100%;
    background: linear-gradient(to bottom, #7a0000, #4a0000);
    color: white;
    border: 1px solid var(--accent-red);
    padding: 15px;
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.login-box button:hover {
    background: linear-gradient(to bottom, #9a0000, #5a0000);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
}

/* =========================================
   SIDEBAR & UI GÉNÉRALE
   ========================================= */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 2px solid var(--accent-gold);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 5px 0 20px rgba(0,0,0,0.8);
    z-index: 100;
}

.app-title {
    font-family: 'Uncial Antiqua', cursive;
    color: var(--accent-red);
    font-size: 28px;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(138, 3, 3, 0.5);
    border-bottom: 1px solid #4a2a2a;
    padding-bottom: 15px;
}

.tool-section {
    margin-bottom: 25px;
}

.tool-section-title {
    color: var(--accent-gold);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(203, 160, 82, 0.3);
    padding-bottom: 5px;
}

.toolbar {
    display: flex; flex-wrap: wrap; gap: 8px;
    background: rgba(0,0,0,0.3); padding: 10px; border-radius: 5px; border: 1px solid #3a1a1a;
}

.toolbar button {
    background: var(--panel-bg); color: var(--accent-gold); border: 1px solid #4a2a2a;
    padding: 8px 12px; cursor: pointer; border-radius: 3px; transition: 0.2s; font-family: 'Cinzel', serif;
}

.toolbar button:hover { background: var(--accent-gold); color: var(--bg-color); }
.toolbar .divider { width: 1px; background: #4a2a2a; margin: 0 5px; }

.menu-btn {
    display: block; width: 100%; background: transparent; color: var(--text-light);
    border: 1px solid transparent; padding: 10px; text-align: left; cursor: pointer;
    font-family: 'Cinzel', serif; transition: 0.2s; border-radius: 3px; margin-bottom: 5px;
}
.menu-btn:hover { background: rgba(138, 3, 3, 0.2); border-color: var(--accent-red); color: var(--accent-red); }
.menu-btn i { width: 25px; text-align: center; color: var(--accent-gold); }

.action-btn { border: 1px solid #4a2a2a; margin-top: 10px; text-align: center; }
.action-btn:hover {
    background: linear-gradient(to bottom, #7a0000, #4a0000);
    box-shadow: 0 0 15px rgba(255,0,0,0.5);
}

.color-picker { display: flex; gap: 10px; }
.color-option { width: 25px; height: 25px; border-radius: 50%; cursor: pointer; border: 2px solid #000; transition: 0.2s; }
.color-option:hover { transform: scale(1.2); border-color: var(--accent-gold); }

/* =========================================
   LE GRIMOIRE (LIVRE & PAGES)
   ========================================= */
.editor-area {
    flex-grow: 1; display: flex; justify-content: center; align-items: flex-start;
    padding: 40px; overflow-y: auto; position: relative;
}

.page-container {
    width: 800px; min-height: 850px; background-color: var(--paper-bg);
    background-image: url('https://www.transparenttextures.com/patterns/old-wall.png'), radial-gradient(circle at 50% 50%, transparent 40%, rgba(139, 105, 80, 0.4) 100%);
    box-shadow: 15px 15px 25px rgba(0,0,0,0.6), inset 0 0 40px rgba(139, 105, 80, 0.2);
    border-radius: 4px; position: relative; padding: 50px 70px;
}

.contenteditable-area {
    width: 100%; min-height: 700px;
    color: #2b1810; font-family: 'Crimson Text', serif; font-size: 21px; line-height: 1.6; outline: none;
}

.contenteditable-area h1 { font-family: 'Uncial Antiqua', cursive; color: #5a0505; text-align: center; font-size: 46px; margin-bottom: 20px;}
.contenteditable-area h2 { font-family: 'Uncial Antiqua', cursive; color: #5a0505; font-size: 30px; margin-bottom: 20px; border-bottom: 1px solid rgba(90,5,5,0.3); padding-bottom: 10px;}
.contenteditable-area p { margin-bottom: 20px; text-align: justify; }

/* Coins décoratifs du parchemin */
.page-corner { position: absolute; width: 40px; height: 40px; border: 2px solid rgba(139, 105, 80, 0.6); pointer-events: none; }
.top-left { top: 15px; left: 15px; border-right: none; border-bottom: none; }
.top-right { top: 15px; right: 15px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 15px; left: 15px; border-right: none; border-top: none; }
.bottom-right { bottom: 15px; right: 15px; border-left: none; border-top: none; }

/* =========================================
   NOTIFICATIONS
   ========================================= */
.notification {
    visibility: hidden; background-color: var(--accent-red); color: #fff; text-align: center; border-radius: 5px;
    padding: 15px 25px; position: fixed; z-index: 2000; bottom: 30px; right: 30px; font-family: 'Cinzel', serif;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8); opacity: 0; transition: opacity 0.5s, visibility 0.5s; border: 1px solid var(--accent-gold);
}
.notification.show { visibility: visible; opacity: 1; }

/* =========================================
   RESPONSIVE DESIGN (MOBILES)
   ========================================= */
@media (max-width: 900px) {
    body { flex-direction: column; overflow-y: auto; height: auto; }
    .sidebar { width: 100%; border-right: none; border-bottom: 2px solid var(--accent-gold); padding: 10px; box-sizing: border-box; }
    .editor-area { padding: 10px; }
    .page-container { width: 100%; padding: 20px 25px; min-height: 60vh; }
    .contenteditable-area { font-size: 18px; }
    .contenteditable-area h1 { font-size: 32px; }
}
