/* ==========================================================================
   Design System & Root Variables (Cloned from CV_4)
   ========================================================================== */
:root {
    /* Color Palette */
    --navy-deep: hsl(210, 60%, 8%);
    --navy-medium: #102A43;
    --gold-dark: #B89742;
    --gold-light: #E3C67C;
    --gold-gradient: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-light) 50%, var(--gold-dark) 100%);
    --accent-navy: linear-gradient(135deg, var(--navy-deep), var(--navy-medium));
    
    /* Backgrounds */
    --cream-bg: #FAF9F6;
    --cream-card: #FCFBFA;
    --desk-bg: #0F0F16; /* Same dark grey/black background as CV_4 */
    --desk-accent: radial-gradient(circle, rgba(184, 151, 66, 0.15) 0%, rgba(15, 15, 22, 0) 70%); /* Warm gold elegant ambient light */
    
    /* Typography */
    --serif-font: 'Cormorant Garamond', serif;
    --body-font: 'Inter', sans-serif;
    
    /* Ink/Text colors */
    --text-dark: #1E2E3E;
    --text-muted: #627D98;
    
    /* Shadows */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hard: 0 20px 40px rgba(0, 0, 0, 0.3);
    --book-shadow-left: -15px 10px 30px rgba(0,0,0,0.15);
    --book-shadow-right: 15px 10px 30px rgba(0,0,0,0.15);
}

/* ==========================================================================
   Base Resets & App Container
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--desk-bg);
    font-family: var(--body-font);
    color: var(--text-dark);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    min-height: 100vh;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    position: relative;
}

.ambient-light {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: var(--desk-accent);
    z-index: 0;
    pointer-events: none;
}

/* ==========================================================================
   Classic Blog Feed Layout
   ========================================================================== */
.blog-header {
    text-align: center;
    margin-bottom: 50px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

.blog-header .logo-emblem {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gold-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(184, 151, 66, 0.3);
    border: 2px solid var(--gold-dark);
    padding: 5px;
    margin-bottom: 20px;
}

.blog-header .logo-emblem img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.blog-header .header-titles {
    text-align: center;
}

.blog-header h1 {
    font-size: 42px;
    margin-bottom: 5px;
}

.blog-feed-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    padding-bottom: 60px;
}

/* ==========================================================================
   Decorative Accents
   ========================================================================== */
.dot-grid {
    background-image: radial-gradient(var(--dot-color, #ccc) 1.5px, transparent 1.5px);
    background-size: 14px 14px;
    width: 112px;
    height: 112px;
    position: absolute;
    opacity: 0.75;
    pointer-events: none;
    z-index: 1;
}

.dot-grid.gold {
    --dot-color: var(--gold-dark);
}

.dot-grid.gray {
    --dot-color: hsl(210, 15%, 75%);
}

.top-right-dots { top: -20px; right: -15px; }
.bottom-left-dots { bottom: -20px; left: -15px; }
.top-left-dots { top: -20px; left: -15px; }
.bottom-right-dots { bottom: -20px; right: -15px; }

/* Accent Bars (hidden by default on mobile) */
.accent-bar {
    position: absolute;
    background: var(--gold-gradient);
    pointer-events: none;
    z-index: 1;
}

/* Ensure content sits above decorative background accents */
.page-content > *:not(.dot-grid):not(.accent-bar) {
    position: relative;
    z-index: 2;
}

/* Post Edit Button Styles */
.edit-post-btn {
    background: none;
    border: none;
    color: var(--gold-dark);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
    padding: 4px;
}
.edit-post-btn:hover {
    opacity: 1 !important;
    color: var(--gold-light) !important;
}

/* Post Delete Button Styles */
.delete-post-btn {
    background: none;
    border: none;
    color: #c9302c;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
    padding: 4px;
}
.delete-post-btn:hover {
    opacity: 1 !important;
    color: #e3524e !important;
}


.gold-vertical-left { left: -45px; top: -50px; width: 6px; height: 120%; }
.gold-vertical-right { right: -45px; top: -50px; width: 6px; height: 120%; }
.gold-vertical-right-thick { right: -45px; top: -50px; width: 14px; height: 120%; }
.gold-vertical-left-thick { left: -45px; top: -50px; width: 14px; height: 120%; }
.gold-vertical-right-side { right: -20px; top: -50px; width: 6px; height: 120%; }
.gold-vertical-left-side { left: -20px; top: -50px; width: 6px; height: 120%; }

.navy-horizontal-top { top: -50px; left: -45px; height: 10px; width: 70%; background: var(--accent-navy); }
.gold-horizontal-bottom { bottom: -50px; left: -45px; height: 6px; width: 60%; }
.gold-horizontal-top { top: -50px; left: -45px; height: 6px; width: 120%; }
.navy-horizontal-bottom { bottom: -50px; left: -45px; height: 10px; width: 120%; background: var(--accent-navy); }
.navy-horizontal-bottom-wide { bottom: -50px; left: -45px; height: 14px; width: 120%; background: var(--accent-navy); }
.navy-horizontal-top-wide { top: -50px; left: -45px; height: 14px; width: 120%; background: var(--accent-navy); }
.gold-horizontal-top-right { top: -50px; right: -45px; height: 6px; width: 50%; }
.navy-vertical-left-thick { left: -45px; top: -50px; width: 14px; height: 120%; background: var(--accent-navy); }
.navy-horizontal-bottom-right { bottom: -50px; right: -45px; height: 10px; width: 70%; background: var(--accent-navy); }
.navy-horizontal-top-right { top: -50px; right: -45px; height: 10px; width: 75%; background: var(--accent-navy); }

/* ==========================================================================
   Typography & Common Elements
   ========================================================================== */
.serif-title {
    font-family: var(--serif-font);
    font-weight: 700;
    color: var(--navy-medium);
    line-height: 1.1;
}

.serif-title .highlight {
    font-weight: 400;
    font-style: italic;
    color: var(--gold-dark);
}

.section-subtitle {
    font-family: var(--body-font);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--gold-dark);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.body-text {
    font-family: var(--body-font);
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-muted);
    font-weight: 300;
}

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

.page-title {
    font-size: 28px;
    margin-bottom: 25px;
    letter-spacing: 1px;
}

/* Image Containers */
.image-container {
    background-color: #ECEAE4;
    border: 1px solid rgba(16,42,67,0.08);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border-radius: 2px;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Removed Cover Page Styles */

/* ==========================================================================
   Blog Post Styling inside Page
   ========================================================================== */
.blog-post-card {
    display: flex;
    flex-direction: column;
    margin-bottom: 40px;
    width: 100%;
    background-color: var(--cream-bg);
    padding: 40px 45px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    position: relative;
}

.blog-post-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.post-actions {
    display: flex;
    gap: 10px;
}

.blog-post-title {
    font-family: var(--serif-font);
    font-size: 20px;
    font-weight: 700;
    color: var(--navy-medium);
    margin-bottom: 4px;
    line-height: 1.25;
}

.blog-post-meta {
    font-family: var(--body-font);
    font-size: 8.5px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.blog-post-body {
    font-family: var(--body-font);
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.blog-post-image-container {
    width: 100%;
    height: 180px;
    margin-bottom: 15px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(16,42,67,0.08);
}

.blog-post-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   Comments Section Styling
   ========================================================================== */
.blog-comments-section {
    width: 100%;
    border-top: 1px solid rgba(16, 42, 67, 0.08);
    padding-top: 12px;
    margin-top: 5px;
}

.comments-header {
    font-family: var(--body-font);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--gold-dark);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: visible; /* Let pagination engine manage height */
    margin-bottom: 12px;
}

.comment-bubble {
    background-color: #F3F1EB;
    border-radius: 10px;
    padding: 8px 12px;
    font-family: var(--body-font);
    font-size: 10px;
    line-height: 1.4;
    color: var(--text-dark);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comment-author {
    color: var(--navy-medium);
}

.comment-date {
    color: var(--text-muted);
}

.comment-text {
    font-weight: 300;
}

/* Comment Form */
.comment-form {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    margin-top: 8px;
}

.comment-input {
    flex-grow: 1;
    height: 30px;
    border-radius: 15px;
    border: 1px solid rgba(16, 42, 67, 0.15);
    background-color: white;
    padding: 0 12px;
    font-family: var(--body-font);
    font-size: 9.5px;
    color: var(--text-dark);
    transition: border-color 0.2s;
}

.comment-input:focus {
    border-color: var(--gold-dark);
    outline: none;
}

.comment-submit-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-navy);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s, background-color 0.2s;
}

.comment-submit-btn:hover {
    transform: scale(1.05);
    background: var(--gold-dark);
}

.comment-submit-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Harry Potter Blog Block System (Opcja A)
   ========================================================================== */

/* The card is now a relative block with glassmorphism */
.blog-post-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
    /* Limit height when collapsed */
    max-height: 200px;
}

/* Mobile cards should expand naturally since pagination is different */
@media (max-width: 990px) {
    .blog-post-card {
        max-height: none !important;
        overflow: visible;
    }
    .blog-post-card.collapsed::after {
        display: none;
    }
    .toggle-btn-container {
        display: none !important;
    }
}

/* Faded state for sibling cards when one is expanded */
.blog-post-card.faded {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    /* Shrink it out of the flow to give the expanded card space */
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border: none;
}

/* Expanded state (Harry Potter magic) */
.blog-post-card.expanded {
    max-height: 480px; /* Full page height */
    overflow-y: auto;
    z-index: 10;
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--gold-light);
    box-shadow: 0 10px 30px rgba(16, 42, 67, 0.15);
}

/* Custom Scrollbar for expanded card */
.blog-post-card.expanded::-webkit-scrollbar {
    width: 6px;
}
.blog-post-card.expanded::-webkit-scrollbar-track {
    background: rgba(16, 42, 67, 0.05);
    border-radius: 3px;
}
.blog-post-card.expanded::-webkit-scrollbar-thumb {
    background: var(--gold-medium);
    border-radius: 3px;
}
.blog-post-card.expanded::-webkit-scrollbar-thumb:hover {
    background: var(--gold-dark);
}

/* Fade out at the bottom of collapsed cards to indicate more content */
.blog-post-card.collapsed::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(transparent, rgba(245, 243, 237, 1) 90%);
    pointer-events: none;
    border-radius: 0 0 8px 8px;
}

/* Container for toggle button */
.toggle-btn-container {
    position: absolute;
    bottom: 12px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 5;
}

/* Container for toggle button when expanded (sticky at bottom) */
.blog-post-card.expanded .toggle-btn-container {
    position: sticky;
    bottom: 0;
    padding: 10px 0;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.95) 40%);
}

/* Toggle button (Mehr anzeigen) */
.mehr-anzeigen-btn {
    background: var(--navy-dark);
    color: white;
    border: 1px solid var(--gold-medium);
    border-radius: 20px;
    padding: 6px 15px;
    font-family: var(--body-font);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mehr-anzeigen-btn:hover {
    background: var(--gold-dark);
    transform: translateY(-2px);
}

/* Positioning for edit/delete buttons inside the card */
.blog-post-card .blog-post-title-row {
    position: relative;
    padding-right: 65px; /* Space for buttons */
}

.blog-post-card .post-actions {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    padding: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Hide comments when collapsed */
.blog-post-card.collapsed .blog-comments-section {
    display: none;
}

/* ==========================================================================
   Navigation Controls UI (Cloned from CV_4)
   ========================================================================== */
.controls-container {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-top: 40px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 25px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    z-index: 2;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    font-family: var(--body-font);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.control-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.control-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.page-indicator {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#currentPage {
    color: var(--gold-light);
    font-weight: 600;
}

.shortcuts-tip {
    margin-top: 15px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    letter-spacing: 0.5px;
    z-index: 2;
}

.shortcuts-tip .key {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
}

/* ==========================================================================
   Post Creator Panel & Trigger Button
   ========================================================================== */
#post-creator-trigger {
    position: fixed;
    top: 25px;
    left: 25px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--gold-gradient);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(184, 151, 66, 0.4);
    z-index: 99;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}

#post-creator-trigger:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 6px 20px rgba(184, 151, 66, 0.5);
}

#post-creator-trigger:active {
    transform: scale(0.95);
}

/* Slide-out Panel */
#post-creator-panel {
    position: fixed;
    top: 0;
    left: -420px;
    width: 400px;
    height: 100vh;
    background: rgba(15, 15, 22, 0.94);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 35px 30px;
    display: flex;
    flex-direction: column;
    color: white;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#post-creator-panel.active {
    left: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 15px;
}

.panel-header h3 {
    font-family: var(--serif-font);
    font-size: 24px;
    font-weight: 700;
    color: var(--gold-light);
}

#close-panel-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

#close-panel-btn:hover {
    color: white;
    transform: rotate(90deg);
}

/* Form Groups */
#post-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom scrollbar for panel form */
#post-form::-webkit-scrollbar {
    width: 5px;
}
#post-form::-webkit-scrollbar-track {
    background: transparent;
}
#post-form::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-family: var(--body-font);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--gold-light);
    text-transform: uppercase;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: white;
    padding: 10px 12px;
    font-family: var(--body-font);
    font-size: 12px;
    transition: border-color 0.2s, background-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    border-color: var(--gold-dark);
    background-color: rgba(255, 255, 255, 0.07);
    outline: none;
}

/* File Upload Button */
.file-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.8);
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--body-font);
    font-size: 11px;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.file-upload-btn:hover {
    background: rgba(184, 151, 66, 0.08);
    border-color: var(--gold-dark);
    color: white;
}

/* Image Preview Container */
#image-preview-container {
    position: relative;
    width: 100%;
    margin-top: 10px;
    border-radius: 4px;
    overflow: hidden;
    display: none;
}

#image-preview-container.has-image {
    display: block;
}

#image-preview {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(15, 15, 22, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ff4d4d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: background-color 0.2s, transform 0.2s;
}

#remove-image-btn:hover {
    background: #ff4d4d;
    color: white;
    transform: scale(1.05);
}

#submit-post-btn {
    background: var(--gold-gradient);
    border: none;
    color: white;
    font-family: var(--body-font);
    font-size: 12px;
    font-weight: 600;
    padding: 14px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(184, 151, 66, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

#submit-post-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(184, 151, 66, 0.35);
}

#submit-post-btn:active {
    transform: translateY(1px);
}

/* ==========================================================================
   Responsive Adaptations (Mobile overrides)
   ========================================================================== */
@media (max-width: 990px) {
    .app-container {
        padding: 80px 15px 40px 15px;
    }
    
    .blog-feed-container {
        width: 100%;
    }

    .blog-post-card {
        padding: 25px 20px;
    }

    #post-creator-trigger {
        top: 15px;
        left: 15px;
        width: 42px;
        height: 42px;
        font-size: 15px;
    }

    #post-creator-panel {
        width: 100%;
        left: -100%;
        padding: 25px 20px;
    }
    
    #post-creator-panel.active {
        left: 0;
    }
}
