@font-face {
    font-family: 'Cocon';
    src: url('fonts/CoconRegularFont.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Otter-type';
    src: url('fonts/otter-type/Ottertype-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Otter-type';
    src: url('fonts/otter-type/Ottertype-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

:root {
    --a4-width: 210mm;
    --a4-height: 297mm;
    --shadow: 0 12px 38px rgba(0, 0, 0, 0.15);
    --deep-black: #121212;
    --soft-gray: #757575;
    --accent: #e0e0e0;
    --primary: #2b2b2b;
    --background: #f7f7f7;
    --control-bg: #ffffff;
    --control-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
    --margin: 40px;
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #eaeaea 100%);
    color: var(--primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: 0;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 20px;
    min-height: 100vh;
}

/* New layout structure */
.main-layout {
    display: flex;
    width: 100%;
    gap: 30px;
    margin-bottom: 20px;
}

/* Control panel (sidebar) */
.controls-sidebar {
    flex: 1;
    max-width: 350px;
    position: sticky;
    top: 20px;
    height: calc(100vh - 120px);
    align-self: flex-start;
}

.controls-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding-right: 10px;
}

.controls {
    background: var(--control-bg);
    box-shadow: var(--control-shadow);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.controls .field {
    display: flex;
    flex-direction: column;
}

.controls label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.controls .optional {
    font-weight: normal;
    color: var(--soft-gray);
    font-size: 0.8rem;
}

.controls input,
.controls textarea,
.controls select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border 0.2s;
}

.controls input:focus,
.controls textarea:focus,
.controls select:focus {
    border-color: #aaa;
    outline: none;
}

/* Custom Font Selector Styles */
.custom-font-select-container {
    position: relative;
    width: 100%;
}

.font-selected {
    background-color: #f9f9f9;
    font-size: 18px;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    transition: all 0.2s;
}

.font-selected:after {
    content: '▼';
    font-size: 12px;
    margin-left: 10px;
    color: #666;
}

.font-selected:hover {
    background-color: #f0f0f0;
    border-color: #ccc;
}

.font-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-top: 4px;
    max-height: 380px; /* Increased to show more options */
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Custom scrollbar style */
.font-options::-webkit-scrollbar {
    width: 8px;
}

.font-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.font-options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.font-options::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.font-options.show {
    display: block;
}

.font-option {
    padding: 12px 15px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    min-height: 25px; /* Ensure minimum height for compact fonts */
}

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

.font-option:hover {
    background-color: #f5f5f5;
}

.font-option.selected {
    background-color: #4CAF50;
    color: white;
}

/* Boutons d'alignement */
.alignment-options {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
}

.align-btn {
    flex: 1;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    height: 44px; /* Fixed height for consistent button size */
}

.align-btn.active {
    background: #e9e9e9;
    border-color: #ccc;
    font-weight: bold;
}

.align-icon {
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Removing the custom positioning that was offsetting the icons */

/* Bouton d'impression */
.controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--deep-black);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
    margin-top: 10px;
}

.controls button:hover {
    background-color: #333;
}

.controls button:active {
    transform: translateY(1px);
}

/* Zone A4 */
.preview-wrapper {
    flex: 2;
    display: flex;
    justify-content: center;
    position: relative;
}

.a4-preview {
    background: white;
    width: var(--a4-width);
    height: var(--a4-height);
    box-shadow: var(--shadow);
    border-radius: 2px;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.quote-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 4rem;
    padding-top: 3rem; /* Slightly increased top space */
    justify-content: flex-start; /* Start content at the top */
    align-items: stretch; /* Allow elements to take full width */
}

.quote {
    font-size: 120px; /* Initial large font size */
    line-height: 1.05; /* Reduced line height (was 1.15) */
    text-align: left; /* Default alignment */
    color: var(--deep-black);
    margin: 0; /* Commence en haut sans marge */
    margin-bottom: 20px; /* Espace entre citation et commentaire */
    position: relative;
    font-weight: normal;
    width: 100%; /* Utilise toute la largeur disponible */
    max-width: 100%;
    /* Suppression de max-height pour permettre l'ajustement automatique */
    overflow: visible; /* Allow full text display */
    word-wrap: break-word; /* Break long words */
    hyphens: none; /* Disable hyphenation to prevent words being cut with hyphens */
    word-break: normal; /* Ensures words are not broken */
    /* Alignment and size are managed by JavaScript */
}

/* Alignments are now managed directly via JavaScript */
/* Alignment classes */
.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.quote::before {
    content: ""; /* Opening quote removed */
    position: absolute;
    font-size: 1.5em;
    opacity: 0.2;
    font-family: Georgia, serif;
    top: -0.3em;
    left: -0.3em;
}

.quote::after {
    content: ""; /* Closing quote removed */
    position: absolute;
    font-size: 1.5em;
    opacity: 0.2;
    font-family: Georgia, serif;
    bottom: -0.6em;
    right: -0.3em;
}

.comment {
    font-size: 18px;
    color: var(--soft-gray);
    margin: 15px 0 30px; /* Added top margin to lower the comment */
    width: 100%; /* Full width for proper alignment */
    font-style: normal;
    max-width: 90%;
    transition: text-align 0.2s ease;
    /* Alignment is inherited from the class applied to the quote */
}

.author {
    font-size: 28px;
    font-style: italic;
    color: var(--text-color);
    text-align: right;
    position: absolute; /* Absolute positioning to be at bottom */
    bottom: 70px; /* Slightly raised (was at 50px) */
    right: 4rem; /* Aligned with right margin */
    max-width: 80%; /* Limit width to avoid overflow */
}

.credit-line {
    font-size: 12px;
    color: #b3b3b3;
    text-align: center;
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    font-family: 'Roboto', sans-serif;
    letter-spacing: 0.02em;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.credit-line:hover {
    opacity: 1;
    color: #999;
}

.credit-field {
    margin: 10px 0;
    padding: 14px 16px;
    background: linear-gradient(145deg, #f9f9f9, #f1f1f1);
    border-radius: 12px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-align: center; /* Centre le contenu */
    display: flex;
    justify-content: center;
}

.credit-field:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #e0e0e0, #f0f0f0, #e0e0e0);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.credit-field:hover {
    background: linear-gradient(145deg, #f5f5f5, #eaeaea);
    border-color: #d0d0d0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.credit-field:hover:before {
    opacity: 1;
    background: linear-gradient(90deg, #d8d8d8, #f0f0f0, #d8d8d8);
}

.credit-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: center;
    width: 100%;
}

.credit-field label {
    cursor: pointer;
    font-weight: 500;
    color: #404040;
    font-size: 15px;
    user-select: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.01em;
    position: relative;
    margin: 0;
    padding: 0;
}

.credit-field label:hover {
    color: #000;
    transform: translateX(2px);
}

.credit-field label .heart-emoji,
.credit-field label .sad-emoji {
    display: inline-block;
    margin-left: 4px;
    transition: transform 0.3s ease;
}

.credit-field label .heart-emoji {
    animation: gentle-pulse 3s infinite ease-in-out;
}

.credit-field label .sad-emoji {
    animation: gentle-shake 3s infinite ease-in-out;
}

@keyframes gentle-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes gentle-shake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

/* Styles for the alignment buttons with new icons */
.align-icon {
    font-size: 20px;
    line-height: 1;
    display: block;
}

/* Reset button styling */
.reset-btn {
    background: #f5f5f5 !important;
    color: #666 !important;
    border: 1px solid #ddd !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    margin-top: 5px;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: #e9e9e9 !important;
    color: #333 !important;
}

/* Download buttons styling */
.download-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
}

.download-buttons button {
    background: #f5f5f5 !important;
    color: #555 !important;
    border: 1px solid #ddd !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    margin-top: 0;
}

.download-buttons button:hover {
    background: #e9e9e9 !important;
    color: #333 !important;
}

/* Support section with Ko-fi button */
.support-section {
    margin-top: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.kofi-container {
    display: flex;
    justify-content: center;
    padding: 5px 0;
}

/* Make sure the Ko-fi button doesn't overflow on small screens */
.kofi-container iframe {
    max-width: 100%;
}

.credit-field:hover label .heart-emoji {
    animation: none;
    transform: scale(1.2);
}

.credit-field:hover label .sad-emoji {
    animation: none;
    transform: rotate(-10deg);
}

.credit-field input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #2b2b2b;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    border-radius: 5px;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid #d0d0d0;
    background-color: white;
    position: relative;
    margin: 0;
}

.credit-field input[type="checkbox"]:checked {
    transform: scale(1.05);
    background-color: #2b2b2b;
    border-color: #2b2b2b;
}

.credit-field input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 16px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.credit-field input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(43, 43, 43, 0.2);
}

.credit-field input[type="checkbox"]:hover {
    border-color: #aaa;
}

.language-selector {
    background-color: #f8f8f8;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.language-selector select {
    font-weight: 500;
}

/* Page header styling - for new SEO structure */
.page-header {
    text-align: center;
    padding: 1rem 0 0.5rem;
    margin-bottom: 1rem;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.page-header .tagline {
    font-size: 1rem;
    color: var(--soft-gray);
    margin-bottom: 1rem;
}

.main-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 1.5rem;
    margin: 1rem 0;
}

.main-nav a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem;
    transition: color 0.3s;
}

.main-nav a:hover,
.main-nav a.active {
    color: #000;
    text-decoration: underline;
}

/* Enhanced footer styling */
.page-footer {
    text-align: center;
    margin-top: 1rem;
    color: var(--soft-gray);
    font-size: 0.9rem;
    padding: 1.5rem 0;
}

.page-footer a {
    color: var(--deep-black);
    text-decoration: none;
    transition: opacity 0.2s;
}

.page-footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

/* About and Privacy page styles */
.about-page .content,
.privacy-page .content {
    background-color: var(--control-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--control-shadow);
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.about-section,
.privacy-section {
    margin-bottom: 2rem;
}

.about-section h2,
.privacy-section h2 {
    margin-bottom: 1rem;
    color: var(--deep-black);
}

.about-section h3,
.privacy-section h3 {
    margin: 1.5rem 0 0.5rem;
    color: var(--deep-black);
}

.about-section p,
.privacy-section p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.about-section ul,
.privacy-section ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

/* Styles responsive */
@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
    }
    
    .controls-sidebar {
        max-width: 100%;
        position: relative;
        top: 0;
        height: auto;
        order: 1; /* Controls go below the preview */
    }
    
    .preview-wrapper {
        order: 0; /* Preview goes above controls */
    }
    
    .a4-preview {
        width: 98%;
        height: auto;
        min-height: 70vh;
        aspect-ratio: 210/297;
    }
    
    .quote {
        font-size: 48px;
    }
    
    .quote-container {
        padding: 2rem;
    }
}

/* Styles pour l'impression */
@media print {
    @page {
        size: A4;
        margin: 0;
    }
    
    body, html {
        width: 210mm;
        height: 297mm;
        margin: 0;
        padding: 0;
        background: white;
    }
    
    .controls-sidebar, .page-footer, .main-layout {
        display: none !important;
    }
    
    .app-container {
        padding: 0;
    }
    
    .preview-wrapper {
        display: block;
        width: 210mm;
        height: 297mm;
    }
    
    .a4-preview {
        box-shadow: none;
        border-radius: 0;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
    }
}

/* Notification System Styles */
.notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 100%;
    max-width: 500px;
    pointer-events: none;
    display: flex;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.4s ease;
    transform: translateX(-50%) translateY(-20px);
}

.notification-container.show {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
}

.notification {
    background-color: rgba(33, 33, 33, 0.95);
    color: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 450px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: notification-bounce 0.5s ease forwards;
}

.notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-right: 15px;
    color: #f08080;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-content {
    flex-grow: 1;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    border-radius: 50%;
}

.notification-close:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

@keyframes notification-bounce {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}