/* =============================================
   assets/css/style.css — Yaddashtio Core Styles
   ============================================= */

/* --- CSS Variables (Light & Dark) --- */
:root {
    --bg: #F7F7F7;
    --paper: #FFFFFF;
    --text: #1A1A1A;
    --text-secondary: #6B7280;
    --border: #EAEAEA;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    --radius: 12px;
}

.dark {
    --bg: #121212;
    --paper: #1E1E1E;
    --text: #E0E0E0;
    --text-secondary: #9CA3AF;
    --border: #333333;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* --- Global --- */
* {
    box-sizing: border-box;
}
body {
    font-family: 'Vazirmatn', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Scrollbar --- */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #4b5563;
}

/* --- Animations --- */
@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.animate-modal-in {
    animation: modal-in 0.2s ease-out;
}

/* --- Project Card --- */
.project-card {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.project-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
    transform: translateY(-2px);
}
.project-card .card-menu-btn {
    opacity: 0;
    transition: opacity 0.2s;
}
.project-card:hover .card-menu-btn {
    opacity: 1;
}

/* --- A5 Paper --- */
.a5-paper {
    width: 660px;
    max-width: 95vw;
    min-height: 880px;
    background: var(--paper);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    transition: all 0.3s;
    position: relative;
}
.a5-paper-inner {
    padding: 2rem 2.25rem;
    display: flex;
    flex-direction: column;
    min-height: 880px;
}
@media (max-width: 700px) {
    .a5-paper {
        width: 100%;
        max-width: 100vw;
        min-height: auto;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .a5-paper-inner {
        padding: 1.25rem;
        min-height: auto;
    }
}

/* --- Paper Sections --- */
.paper-header {
    border-bottom: 2px dashed var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}
.paper-body {
    display: flex;
    gap: 1.25rem;
    flex: 1;
    min-height: 400px;
}
.paper-footer {
    border-top: 2px dashed var(--border);
    padding-top: 0.75rem;
    margin-top: 1rem;
}
.ideas-column {
    width: 25%;
    min-width: 100px;
    border-left: 1px solid var(--border);
    padding-left: 0.75rem;
}
.main-note-column {
    width: 75%;
    flex: 1;
}
@media (max-width: 600px) {
    .paper-body {
        flex-direction: column;
    }
    .ideas-column {
        width: 100%;
        border-left: none;
        border-bottom: 1px solid var(--border);
        padding-left: 0;
        padding-bottom: 0.75rem;
    }
    .main-note-column {
        width: 100%;
    }
}

/* --- Editable Areas --- */
.editable-area {
    outline: none;
    min-height: 30px;
    cursor: text;
    line-height: 1.9;
    font-size: 0.95rem;
    transition: background 0.15s;
    border-radius: 4px;
    padding: 2px 4px;
}
.editable-area:empty::before {
    content: attr(data-placeholder);
    color: #c5c5c5;
    pointer-events: none;
}
.dark .editable-area:empty::before {
    color: #555;
}
.editable-area:focus {
    background: rgba(59, 130, 246, 0.03);
}
.header-editable {
    font-size: 1.3rem;
    font-weight: 700;
    min-height: 40px;
}
.footer-editable {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-height: 25px;
}
.ideas-editable {
    font-size: 0.85rem;
    line-height: 1.8;
    color: #555;
}
.dark .ideas-editable {
    color: #aaa;
}

/* --- Editor Content Styles --- */
.main-editable h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0.75em 0 0.3em;
    line-height: 1.4;
}
.main-editable h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0.6em 0 0.25em;
    line-height: 1.45;
}
.main-editable h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.5em 0 0.2em;
    line-height: 1.5;
}
.main-editable p {
    margin: 0.4em 0;
    line-height: 1.9;
}
.main-editable blockquote {
    border-right: 3px solid var(--accent);
    padding: 0.4em 0.8em;
    margin: 0.5em 0;
    background: rgba(59, 130, 246, 0.04);
    border-radius: 0 6px 6px 0;
    color: #555;
}
.dark .main-editable blockquote {
    background: rgba(59, 130, 246, 0.08);
    color: #bbb;
}
.main-editable ul,
.main-editable ol {
    padding-right: 1.5em;
    margin: 0.4em 0;
}
.main-editable li {
    margin: 0.2em 0;
    line-height: 1.8;
}
.main-editable hr {
    border: none;
    border-top: 2px dashed var(--border);
    margin: 1em 0;
}
.main-editable img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5em 0;
    cursor: pointer;
    display: block;
}
.main-editable img:hover {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.main-editable a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.main-editable a:hover {
    color: var(--accent-hover);
}
.main-editable mark {
    background-color: #fef08a;
    padding: 0 2px;
    border-radius: 2px;
}
.dark .main-editable mark {
    background-color: #854d0e;
    color: #fef9c3;
}
.main-editable .task-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    margin: 0.25em 0;
}
.main-editable .task-item input[type="checkbox"] {
    margin-top: 0.35em;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}
.main-editable .task-item span {
    flex: 1;
    line-height: 1.8;
}
.main-editable .task-item input:checked+span {
    text-decoration: line-through;
    opacity: 0.6;
}

/* --- Floating Toolbar --- */
.floating-toolbar {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 50;
}
.floating-toolbar.show {
    display: flex;
    opacity: 1;
}
.toolbar-btn {
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--text);
    transition: all 0.15s;
    white-space: nowrap;
    font-family: inherit;
}
.toolbar-btn:hover {
    background: #e5e7eb;
}
.dark .toolbar-btn:hover {
    background: #374151;
}
.toolbar-btn.active {
    background: var(--accent);
    color: #fff;
}

/* --- Page Thumbnails --- */
.page-thumb {
    width: 32px;
    height: 42px;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--paper);
    flex-shrink: 0;
    color: var(--text);
}
.page-thumb:hover {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}
.page-thumb.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    font-weight: bold;
}

/* --- Print Styles --- */
@media print {
    @page {
        size: A5;
        margin: 0;
    }
    body {
        background: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    header,
    aside,
    #floatingToolbar,
    #saveIndicator,
    #linkModal,
    #toastNote,
    .floating-toolbar,
    #pageSidebar,
    #darkModeToggleNote,
    #printBtn,
    label,
    .paper-header label,
    .paper-footer label,
    .ideas-column label,
    .main-note-column label {
        display: none !important;
    }
    .a5-paper {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 148mm !important;
        max-width: 148mm !important;
        min-height: 210mm !important;
        height: auto !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        page-break-after: always;
    }
    .a5-paper-inner {
        padding: 12mm 14mm !important;
        min-height: auto !important;
    }
    main {
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }
    .editable-area {
        -webkit-user-modify: read-only !important;
    }
    .paper-header,
    .paper-footer {
        border-color: #ddd !important;
    }
    .ideas-column {
        border-color: #ddd !important;
    }
}

/* --- Misc --- */
.hidden {
    display: none !important;
}
#saveIndicator {
    white-space: nowrap;
}
</style>