@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Lato:wght@300;400;700&family=Caveat:wght@400;600;700&display=swap');

/* ===== ZMIENNE MOTYWU PAMIĘTNIKA ===== */
:root {
    --diary-bg: #edf2fb;
    --diary-paper: #f5f8fd;
    --diary-paper-dark: #e8f0fa;
    --diary-accent: #1e4a8a;
    --diary-accent-light: #2d72d2;
    --diary-accent-muted: #6fa3d4;
    --diary-accent-hover: #163a72;
    --diary-border: #b5cfe8;
    --diary-border-light: #d4e6f7;
    --diary-text: #1a2d4a;
    --diary-muted: #567a9e;
    --diary-line: rgba(80, 140, 200, 0.2);
    --diary-success: #2d7a4a;
    --diary-success-bg: #d4edda;
    --diary-danger: #8b2020;
    --diary-shadow: rgba(20, 60, 130, 0.12);
    --diary-shadow-strong: rgba(20, 60, 130, 0.22);
}

/* ===== PODSTAWA ===== */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

body {
    font-family: 'Lato', 'Segoe UI', Arial, sans-serif;
    background-color: var(--diary-bg);
    color: var(--diary-text);
    margin-bottom: 70px;
    background-image:
        repeating-linear-gradient(
            transparent,
            transparent 27px,
            var(--diary-line) 27px,
            var(--diary-line) 28px
        );
    background-attachment: fixed;
}

/* ===== TYPOGRAFIA ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--diary-accent);
}

a {
    color: var(--diary-accent-light);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--diary-accent-hover);
    text-decoration: underline;
}

/* ===== NAVBAR ===== */
.navbar-diary {
    background-color: var(--diary-accent) !important;
    border-bottom: 3px solid var(--diary-accent-light);
    box-shadow: 0 2px 10px var(--diary-shadow-strong);
    padding: 0.6rem 1rem;
}

.navbar-brand-diary {
    font-family: 'Caveat', cursive;
    font-size: 1.9rem;
    color: #deeafb !important;
    font-weight: 700;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.navbar-brand-diary:hover {
    color: #ffffff !important;
    text-decoration: none;
}

.navbar-diary .nav-link {
    color: #deeafb !important;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    letter-spacing: 0.4px;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.navbar-diary .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.navbar-diary .nav-link.active-nav {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.18);
}

.navbar-diary .navbar-toggler {
    border-color: rgba(222, 234, 251, 0.5);
}

.navbar-diary .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(222, 234, 251, 0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.btn-logout-nav {
    background: none;
    border: 1.5px solid rgba(222, 234, 251, 0.5);
    color: #deeafb !important;
    font-family: 'Lato', sans-serif;
    font-size: 0.9rem;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-logout-nav:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(222, 234, 251, 0.9);
    color: #fff !important;
}

/* ===== PRZYCISKI ===== */
.btn-diary {
    background-color: var(--diary-accent);
    color: #e8f2ff;
    border: none;
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: 4px;
    padding: 0.5rem 1.3rem;
    transition: background-color 0.2s, transform 0.1s;
    display: inline-block;
}

@keyframes diary-spin {
    to { transform: rotate(360deg); }
}
.btn-spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: diary-spin 0.65s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
}
.btn-diary:disabled,
.btn-diary[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-diary:hover {
    background-color: var(--diary-accent-hover);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-diary:active {
    transform: translateY(0);
}

.btn-diary-outline {
    background: transparent;
    color: var(--diary-accent);
    border: 1.5px solid var(--diary-accent);
    border-radius: 4px;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    padding: 0.4rem 1rem;
    transition: all 0.2s;
    display: inline-block;
}

.btn-diary-outline:hover {
    background-color: var(--diary-accent);
    color: #e8f2ff;
    text-decoration: none;
}

.btn-diary-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
}

/* ===== KARTY / PAPIER ===== */
.diary-card {
    background: var(--diary-paper);
    border: 1px solid var(--diary-border);
    border-radius: 5px;
    box-shadow: 2px 4px 14px var(--diary-shadow);
    padding: 1.8rem 2rem;
    margin-bottom: 1.5rem;
}

.chat-room-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.2rem;
    height: calc(100vh - 120px);
    min-height: 500px;
}

.chat-sidebar,
.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-sidebar-header,
.chat-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--diary-border);
}

.chat-sidebar-header h3,
.chat-main-header h2 {
    margin: 0;
    font-size: 1.35rem;
}

.chat-room-info {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--diary-border);
    border-radius: 12px;
}

.chat-room-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--diary-border);
}

.chat-users-section--fill {
    margin-top: 0;
}

.chat-window {
    flex: 1;
    min-height: 0;
    padding: 1rem;
    margin-top: 1rem;
    background: #f3f7ff;
    border-radius: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.chat-empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--diary-muted);
}

.chat-message {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(170, 187, 216, 0.45);
    box-shadow: 0 2px 12px rgba(20, 60, 130, 0.06);
}

.chat-message-self {
    justify-content: flex-end;
    background: rgba(226, 233, 255, 0.95);
}

.chat-message-avatar {
    min-width: 42px;
    min-height: 42px;
    border-radius: 50%;
    background: var(--diary-accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.05rem;
}

.chat-message-body {
    flex: 1;
}

.chat-message-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.45rem;
    color: var(--diary-muted);
}

.chat-message-body strong {
    color: var(--diary-accent-hover);
}

.chat-message-body p {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-footer {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--diary-border);
}

.chat-input-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.chat-image-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    color: var(--diary-accent);
    cursor: pointer;
    transition: background 0.15s;
}
.chat-image-btn:hover {
    background: rgba(111, 163, 212, 0.15);
}

.chat-image-preview-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(111, 163, 212, 0.1);
    border-radius: 10px;
    border: 1px solid var(--diary-border);
}
.chat-image-preview-bar img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}
.chat-image-preview-name {
    flex: 1;
    font-size: 0.8rem;
    color: var(--diary-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-image-preview-clear {
    background: none;
    border: none;
    color: var(--diary-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.2rem;
}

.chat-image {
    display: block;
    max-width: 220px;
    max-height: 220px;
    border-radius: 10px;
    margin-top: 0.5rem;
    cursor: pointer;
    object-fit: cover;
    border: 1px solid var(--diary-border);
    transition: opacity 0.15s;
}
.chat-image:hover {
    opacity: 0.88;
}

.chat-input {
    flex: 1;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--diary-border);
    padding: 0 1rem;
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}

.chat-input:focus {
    border-color: var(--diary-accent);
}

.chat-main-header p {
    margin: 0;
}

.chat-users-section {
    margin-top: 1rem;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-users-section h5 {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--diary-muted);
    margin-bottom: 0.6rem;
}

.chat-users-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.chat-user-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.5rem;
    border-radius: 10px;
    font-size: 0.88rem;
    color: var(--diary-text);
    transition: background 0.15s;
}

.chat-user-item:hover {
    background: rgba(170, 187, 216, 0.18);
}

.chat-user-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #27ae60;
    flex-shrink: 0;
}

@media (max-width: 992px) {
    .chat-room-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat-sidebar,
    .chat-main {
        height: auto;
        overflow: visible;
    }

    .chat-window {
        min-height: 400px;
        max-height: 60vh;
    }
}
    margin: 0;
}

.diary-section-body {
    padding: 1.5rem;
}

.diary-section {
    background: var(--diary-paper);
    border: 1px solid var(--diary-border);
    border-radius: 5px;
    box-shadow: 2px 4px 14px var(--diary-shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.diary-section-header {
    background-color: var(--diary-accent);
    color: #deeafb;
    padding: 0.8rem 1.5rem;
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.diary-section-body {
    padding: 1.5rem;
}

/* ===== WYSZUKIWANIE ===== */
.diary-search-input {
    flex: 1;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--diary-border);
    border-radius: 6px;
    background: var(--diary-paper);
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    color: var(--diary-ink);
    outline: none;
    transition: border-color 0.2s;
}
.diary-search-input:focus {
    border-color: var(--diary-accent);
}

/* ===== WPISY PAMIĘTNIKA - LISTA ===== */
.diary-entry-card {
    background: var(--diary-paper);
    border: 2px solid var(--diary-border);
    border-radius: 8px;
    margin-bottom: 1.1rem;
    box-shadow: 2px 4px 12px var(--diary-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.diary-entry-card:hover {
    box-shadow: 4px 7px 22px var(--diary-shadow-strong);
    border-color: var(--diary-accent-muted);
}

.diary-entry-header {
    background: var(--diary-accent);
    padding: 0.45rem 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.diary-entry-date {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: #deeafb;
    display: block;
    letter-spacing: 0.3px;
}

.diary-entry-body {
    padding: 0.9rem 1.3rem 1rem;
}

.diary-entry-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    color: var(--diary-accent);
    font-weight: 600;
    margin: 0 0 0.55rem 0;
}

.diary-entry-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.diary-entry-meta {
    font-size: 0.82rem;
    color: var(--diary-muted);
}

.diary-entry-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

/* ===== KARTA POJEDYNCZEGO POSTU (Details) ===== */
.post-block-card {
    background: var(--diary-paper);
    border: 1.5px solid var(--diary-accent-muted);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 1px 3px 12px rgba(30, 74, 138, 0.11);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.post-block-card:hover {
    box-shadow: 2px 5px 18px rgba(30, 74, 138, 0.18);
    border-color: var(--diary-accent-light);
}

.post-block-header {
    background: var(--diary-accent);
    padding: 0.42rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.post-block-date {
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    color: #deeafb;
    letter-spacing: 0.3px;
}

.post-block-time {
    font-family: 'Lato', sans-serif;
    font-size: 0.8rem;
    color: rgba(222, 234, 251, 0.72);
    letter-spacing: 0.3px;
}

.post-block-body {
    padding: 1.1rem 1.3rem 0.9rem;
}

/* ===== CHIP Z DATĄ (w nagłówku Details / Edit) ===== */
.entry-date-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--diary-accent);
    color: #deeafb;
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    letter-spacing: 0.3px;
    padding: 0.22rem 0.85rem;
    border-radius: 20px;
    margin-top: 0.25rem;
}

/* ===== SZCZEGÓŁY WPISU ===== */
.diary-content {
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    line-height: 1.9;
    color: var(--diary-text);
    white-space: pre-wrap;
}

.diary-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.diary-photo-thumb {
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid var(--diary-border);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.diary-photo-thumb:hover {
    transform: scale(1.03);
    border-color: var(--diary-accent-light);
}

/* ===== FORMULARZE ===== */
.form-control, .form-select {
    background-color: #f8fbff;
    border: 1px solid var(--diary-border);
    border-radius: 4px;
    color: var(--diary-text);
    font-family: 'Lato', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    background-color: #f8fbff;
    border-color: var(--diary-accent-muted);
    box-shadow: 0 0 0 0.2rem rgba(111, 163, 212, 0.3);
}

.form-label {
    font-family: 'Playfair Display', serif;
    color: var(--diary-accent);
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 0.3rem;
}

.form-check-input:checked {
    background-color: var(--diary-accent);
    border-color: var(--diary-accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(111, 163, 212, 0.3);
    border-color: var(--diary-accent-muted);
}

textarea.form-control {
    min-height: 180px;
    line-height: 1.8;
}

.photo-upload-area {
    border: 2px dashed var(--diary-border);
    border-radius: 5px;
    padding: 1.5rem;
    text-align: center;
    background: var(--diary-paper-dark);
    transition: border-color 0.2s, background-color 0.2s;
    cursor: pointer;
}

.photo-upload-area:hover, .photo-upload-area.dragover {
    border-color: var(--diary-accent-light);
    background-color: #deeafb;
}

.photo-upload-area .upload-icon {
    font-size: 2.5rem;
    color: var(--diary-muted);
    display: block;
    margin-bottom: 0.5rem;
}

/* ===== KALENDARZ (GOOGLE CALENDAR STYLE) ===== */
.gcal-container {
    background: var(--diary-paper);
    border: 1px solid var(--diary-border);
    border-radius: 6px;
    box-shadow: 2px 4px 16px var(--diary-shadow);
    overflow: hidden;
}

.gcal-header {
    background-color: var(--diary-accent);
    color: #deeafb;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gcal-month-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    text-transform: capitalize;
    margin: 0;
    color: #fff;
}

.gcal-nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #deeafb;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.2s;
    cursor: pointer;
}

.gcal-nav-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
    text-decoration: none;
}

.gcal-nav-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gcal-header-spacer {
    width: 140px;
}

.gcal-today-btn {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #deeafb;
    font-family: 'Lato', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 4px;
    padding: 0.3rem 0.8rem;
    text-decoration: none;
    transition: background-color 0.2s;
}

.gcal-today-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    text-decoration: none;
}

.gcal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: var(--diary-paper-dark);
    border-bottom: 2px solid var(--diary-border);
}

.gcal-weekday {
    text-align: center;
    padding: 0.6rem 0.3rem;
    font-family: 'Lato', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--diary-muted);
}

.gcal-weekday.weekend {
    color: var(--diary-accent-light);
}

.gcal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.gcal-day {
    min-height: 100px;
    padding: 0.4rem 0.4rem 0.5rem;
    border-right: 1px solid var(--diary-border-light);
    border-bottom: 1px solid var(--diary-border-light);
    background: var(--diary-paper);
    transition: background-color 0.15s;
    position: relative;
}

.gcal-day:hover {
    background-color: rgba(220, 235, 255, 0.65);
}

.gcal-day:nth-child(7n) {
    border-right: none;
}

.gcal-day.other-month {
    background-color: rgba(200, 220, 248, 0.15);
}

.gcal-day.other-month .gcal-day-number {
    color: #a0b8d8;
}

.gcal-day.today .gcal-day-number {
    background-color: var(--diary-accent);
    color: white !important;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.gcal-day-number {
    font-family: 'Lato', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--diary-text);
    display: inline-block;
    min-width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    margin-bottom: 0.2rem;
}

.gcal-day.weekend-day .gcal-day-number {
    color: var(--diary-accent-light);
}

.gcal-add-link {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    width: 18px;
    height: 18px;
    background: var(--diary-accent);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    display: none;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1;
    transition: background-color 0.2s;
}

.gcal-add-link:hover {
    background: var(--diary-accent-hover);
    color: white;
    text-decoration: none;
}

.gcal-day:hover .gcal-add-link {
    display: inline-flex;
}

.gcal-event {
    display: block;
    margin: 1px 0;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-family: 'Lato', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: opacity 0.15s;
    text-decoration: none;
}

.gcal-event:hover {
    opacity: 0.85;
    text-decoration: none;
}

.gcal-event.active {
    background-color: var(--diary-accent);
    color: #deeafb;
}

.gcal-event.completed {
    background-color: var(--diary-success);
    color: #e8f5ec;
}

/* Popup podglądu zdarzenia */
.gcal-event-popup {
    position: fixed;
    background: var(--diary-paper);
    border: 1px solid var(--diary-border);
    border-radius: 6px;
    box-shadow: 3px 6px 24px var(--diary-shadow-strong);
    padding: 1rem 1.2rem;
    min-width: 220px;
    max-width: 300px;
    z-index: 1000;
    display: none;
}

.gcal-event-popup.visible {
    display: block;
}

.gcal-event-popup-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    color: var(--diary-accent);
    margin-bottom: 0.3rem;
}

.gcal-event-popup-date {
    font-size: 0.8rem;
    color: var(--diary-muted);
    margin-bottom: 0.3rem;
}

/* Lista wydarzeń pod kalendarzem */
.gcal-events-list {
    padding: 1rem 1.5rem;
    border-top: 2px solid var(--diary-border-light);
}

.gcal-event-row {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--diary-border-light);
}

.gcal-event-row:last-child {
    border-bottom: none;
}

.gcal-event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 0.3rem;
    flex-shrink: 0;
}

.gcal-event-dot.active { background: var(--diary-accent); }
.gcal-event-dot.completed { background: var(--diary-success); }

/* ===== STRONY AUTH (LOGIN / REJESTRACJA / INNE) ===== */
.auth-wrapper {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--diary-paper);
    border: 1px solid var(--diary-border);
    border-radius: 8px;
    box-shadow: 3px 6px 24px var(--diary-shadow-strong);
    padding: 2.5rem 2.5rem 2rem;
    width: 100%;
    max-width: 440px;
    position: relative;
}

.auth-card::before {
    content: '';
    position: absolute;
    left: 52px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(45, 114, 210, 0.22);
    border-radius: 1px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 0.3rem;
}

.auth-logo-icon {
    font-size: 2.8rem;
    display: block;
    margin-bottom: 0.2rem;
}

.auth-title {
    font-family: 'Caveat', cursive;
    color: var(--diary-accent);
    text-align: center;
    font-size: 2.3rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--diary-muted);
    font-size: 0.88rem;
    margin-bottom: 1.8rem;
    font-family: 'Lato', sans-serif;
}

.auth-divider {
    border: none;
    border-top: 1px solid var(--diary-border);
    margin: 1.2rem 0;
}

.auth-link-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--diary-muted);
}

.auth-info-box {
    background: var(--diary-paper-dark);
    border: 1px solid var(--diary-border);
    border-radius: 5px;
    padding: 1.2rem 1.5rem;
    text-align: center;
    color: var(--diary-muted);
    font-family: 'Lato', sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
}

.auth-info-box .auth-info-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.6rem;
}

/* ===== STOPKA ===== */
.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px;
    line-height: 60px;
    background-color: var(--diary-accent);
    color: rgba(222, 234, 251, 0.8);
    font-size: 0.85rem;
}

.footer a {
    color: var(--diary-accent-muted);
}

.footer a:hover {
    color: #deeafb;
}

/* ===== GŁÓWNA STRONA ===== */
.home-hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.home-hero-title {
    font-family: 'Caveat', cursive;
    font-size: 3.5rem;
    color: var(--diary-accent);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.home-hero-subtitle {
    font-family: 'Lato', sans-serif;
    font-size: 1.05rem;
    color: var(--diary-muted);
    max-width: 560px;
    margin: 0 auto 1.5rem;
    line-height: 1.7;
}

.home-feature-card {
    background: var(--diary-paper);
    border: 1px solid var(--diary-border);
    border-top: 4px solid var(--diary-accent-light);
    border-radius: 6px;
    padding: 1.8rem 1.5rem;
    text-align: center;
    box-shadow: 2px 4px 12px var(--diary-shadow);
    transition: box-shadow 0.2s, transform 0.2s;
    height: 100%;
}

.home-feature-card:hover {
    box-shadow: 3px 6px 20px var(--diary-shadow-strong);
    transform: translateY(-3px);
}

.home-feature-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.8rem;
}

.home-feature-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--diary-accent);
    margin-bottom: 0.5rem;
}

/* ===== ALERTY ===== */
.alert-diary {
    background: #e8f2fd;
    border: 1px solid var(--diary-accent-muted);
    border-radius: 4px;
    color: var(--diary-text);
    font-family: 'Lato', sans-serif;
}

.alert-diary-success {
    background: #eaf7ee;
    border: 1px solid #a8d5b5;
    border-radius: 8px;
    color: #1e6b3a;
    font-family: 'Lato', sans-serif;
    font-size: 0.93rem;
    padding: 0.7rem 1rem;
}

.profile-email-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 1.5rem;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--diary-border);
    border-radius: 10px;
}

.profile-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--diary-muted);
}

.profile-email {
    font-family: 'Lato', sans-serif;
    color: var(--diary-text);
    font-size: 0.95rem;
}

.diary-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--diary-muted);
    margin-top: 0.3rem;
    font-family: 'Lato', sans-serif;
}

/* ===== WALIDACJA ===== */
.text-danger {
    color: var(--diary-danger) !important;
    font-size: 0.83rem;
}

/* ===== FOCUS ===== */
.btn:focus, .btn:active:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(111, 163, 212, 0.5);
}

/* ===== BADGE STATUSU ===== */
.badge-diary-active {
    background-color: var(--diary-accent);
    color: #deeafb;
    font-family: 'Lato', sans-serif;
    font-size: 0.75rem;
    padding: 0.3em 0.6em;
    border-radius: 3px;
}

.badge-diary-done {
    background-color: var(--diary-success);
    color: #e8f5ec;
    font-family: 'Lato', sans-serif;
    font-size: 0.75rem;
    padding: 0.3em 0.6em;
    border-radius: 3px;
}

/* ===== ZDJĘCIA W MODALU ===== */
.photo-modal-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 4px;
}

/* ===== EDYTOR BLOKOWY ===== */
.editor-block {
    background: var(--diary-paper);
    border: 1px solid var(--diary-border);
    border-radius: 6px;
    margin-bottom: 0.8rem;
    overflow: hidden;
    box-shadow: 1px 2px 6px var(--diary-shadow);
    transition: box-shadow 0.2s;
}

.editor-block:focus-within {
    box-shadow: 2px 4px 12px var(--diary-shadow-strong);
    border-color: var(--diary-accent-muted);
}

.editor-block-header {
    background: var(--diary-paper-dark);
    border-bottom: 1px solid var(--diary-border-light);
    padding: 0.45rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.editor-block-label {
    font-family: 'Lato', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--diary-muted);
}

.editor-block-body {
    padding: 0.9rem 1rem;
}

.block-datetime-input {
    font-family: 'Lato', sans-serif;
    font-size: 0.75rem;
    border: 1px solid var(--diary-border);
    border-radius: 4px;
    padding: 2px 6px;
    color: var(--diary-muted);
    background: var(--diary-paper);
    cursor: pointer;
}

.editor-block textarea {
    width: 100%;
    border: none;
    background: transparent;
    resize: vertical;
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    line-height: 1.85;
    color: var(--diary-text);
    min-height: 100px;
    outline: none;
    padding: 0;
}

.editor-block textarea::placeholder {
    color: var(--diary-muted);
    font-style: italic;
}

.editor-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.editor-image-thumb {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    border: 2px solid var(--diary-border);
    overflow: hidden;
    flex-shrink: 0;
}

.editor-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.editor-image-count {
    font-size: 0.82rem;
    color: var(--diary-muted);
    font-family: 'Lato', sans-serif;
    margin-bottom: 0.4rem;
}

.btn-block-remove {
    background: none;
    border: none;
    color: var(--diary-muted);
    font-size: 0.78rem;
    font-family: 'Lato', sans-serif;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.15s, color 0.15s;
}

.btn-block-remove:hover {
    background-color: rgba(139, 32, 32, 0.1);
    color: var(--diary-danger);
}

.add-block-row {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    padding: 0.9rem 1rem;
    border: 2px dashed var(--diary-border);
    border-radius: 6px;
    background: var(--diary-paper-dark);
    margin-top: 0.4rem;
    transition: border-color 0.2s, background-color 0.2s;
}

.add-block-row:hover {
    border-color: var(--diary-accent-muted);
    background-color: #deeafb;
}

.btn-add-block {
    background: var(--diary-paper);
    border: 1.5px solid var(--diary-border);
    color: var(--diary-accent);
    font-family: 'Lato', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.5rem 1.1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-add-block:hover {
    background: var(--diary-accent);
    border-color: var(--diary-accent);
    color: #e8f2ff;
}

/* ===== MINIATURKA NA LIŚCIE ===== */
.entry-thumbnail {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid var(--diary-border);
    flex-shrink: 0;
}

/* ===== WIDOK SZCZEGÓŁÓW — BLOKI ===== */
.detail-block-text {
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    line-height: 1.9;
    color: var(--diary-text);
    white-space: pre-wrap;
    margin-bottom: 1.2rem;
}

.detail-block-images {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.7rem;
    margin-bottom: 1.2rem;
}

.detail-block-image-wrap {
    position: relative;
    display: inline-block;
}

.detail-block-img {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 5px;
    border: 2px solid var(--diary-border);
    cursor: pointer;
    transition: transform 0.18s, border-color 0.18s;
    display: block;
}

.detail-block-img:hover {
    transform: scale(1.03);
    border-color: var(--diary-accent-light);
}

.btn-delete-block-img {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(139, 32, 32, 0.82);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.15s;
}

.detail-block-image-wrap:hover .btn-delete-block-img {
    display: flex;
}

/* ===== DETAIL – CAROUSEL ZDJĘĆ ===== */
.detail-block-carousel {
    margin-bottom: 1.2rem;
    border-radius: 7px;
    overflow: hidden;
    border: 2px solid var(--diary-border);
    background: #0d1b2e;
    position: relative;
}

.detail-block-carousel .carousel-inner {
    max-height: 420px;
}

.detail-block-carousel .carousel-item {
    text-align: center;
}

.detail-block-carousel .carousel-img {
    max-height: 420px;
    width: 100%;
    object-fit: contain;
    cursor: pointer;
}

.detail-block-carousel .carousel-control-prev,
.detail-block-carousel .carousel-control-next {
    background: rgba(30, 74, 138, 0.4);
    width: 9%;
    transition: background-color 0.2s;
}

.detail-block-carousel .carousel-control-prev:hover,
.detail-block-carousel .carousel-control-next:hover {
    background: rgba(30, 74, 138, 0.72);
}

.detail-block-carousel .carousel-indicators {
    margin-bottom: 0.4rem;
}

.detail-block-carousel .carousel-indicators [data-bs-target] {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background-color: rgba(200, 220, 255, 0.45);
    margin: 0 3px;
    transition: background-color 0.2s;
}

.detail-block-carousel .carousel-indicators .active {
    background-color: #deeafb;
}

.carousel-slide-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
}

.carousel-slide-wrap .btn-delete-block-img {
    display: none;
}

.carousel-slide-wrap:hover .btn-delete-block-img {
    display: flex;
}

/* ===== PAGINACJA ===== */
.pagination-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.2rem;
}

.pagination-info {
    font-family: 'Lato', sans-serif;
    font-size: 0.82rem;
    color: var(--diary-muted);
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.55rem;
    border: 1.5px solid var(--diary-border);
    border-radius: 5px;
    background: var(--diary-paper);
    color: var(--diary-accent);
    font-family: 'Lato', sans-serif;
    font-size: 0.88rem;
    text-decoration: none;
    transition: background-color 0.18s, border-color 0.18s, color 0.18s;
    cursor: pointer;
    user-select: none;
}

.pg-btn:hover {
    background: var(--diary-accent);
    border-color: var(--diary-accent);
    color: #e8f2ff;
    text-decoration: none;
}

.pg-btn.current {
    background: var(--diary-accent);
    border-color: var(--diary-accent);
    color: #e8f2ff;
    font-weight: 700;
    pointer-events: none;
}

.pg-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: default;
}

.pg-arrow {
    font-size: 1rem;
    font-weight: 700;
}

.pg-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 36px;
    color: var(--diary-muted);
    font-family: 'Lato', sans-serif;
    font-size: 0.95rem;
    pointer-events: none;
    user-select: none;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pg-size-label {
    font-family: 'Lato', sans-serif;
    font-size: 0.82rem;
    color: var(--diary-muted);
}

.pg-size-btn {
    border: 1.5px solid var(--diary-border);
    border-radius: 4px;
    background: var(--diary-paper);
    color: var(--diary-muted);
    font-family: 'Lato', sans-serif;
    font-size: 0.8rem;
    padding: 3px 9px;
    text-decoration: none;
    transition: all 0.18s;
    cursor: pointer;
}

.pg-size-btn:hover {
    border-color: var(--diary-accent-muted);
    color: var(--diary-accent);
    text-decoration: none;
}

.pg-size-btn.current {
    background: var(--diary-accent);
    border-color: var(--diary-accent);
    color: #e8f2ff;
    font-weight: 700;
    pointer-events: none;
}

/* ===== MODAL POTWIERDZENIA ===== */
.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 30, 70, 0.55);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.2s;
}

.confirm-modal-backdrop.visible {
    opacity: 1;
}

.confirm-modal-card {
    background: var(--diary-paper);
    border: 1px solid var(--diary-border);
    border-top: 4px solid var(--diary-accent);
    border-radius: 10px;
    box-shadow: 0 10px 48px rgba(10, 30, 70, 0.38);
    padding: 2rem 2.2rem 1.8rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.9) translateY(-16px);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.confirm-modal-backdrop.visible .confirm-modal-card {
    transform: scale(1) translateY(0);
}

.confirm-modal-icon {
    font-size: 2.6rem;
    display: block;
    margin-bottom: 0.6rem;
}

.confirm-modal-title {
    font-family: 'Playfair Display', serif;
    color: var(--diary-accent);
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
}

.confirm-modal-message {
    color: var(--diary-muted);
    font-family: 'Lato', sans-serif;
    font-size: 0.93rem;
    margin-bottom: 1.6rem;
    line-height: 1.65;
}

.confirm-modal-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
}

.btn-diary-danger {
    background: #c0392b;
    color: #fff;
    border: 2px solid #c0392b;
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-diary-danger:hover {
    background: #a93226;
    border-color: #a93226;
    color: #fff;
    text-decoration: none;
}

.btn-delete-block-img:hover {
    background: rgba(139, 32, 32, 1);
}

/* ===== MOBILE (< 576px) ===== */
@media (max-width: 575.98px) {

    /* --- Navbar --- */
    .navbar-brand-diary {
        font-size: 1.3rem;
    }

    /* --- Nagłówki stron --- */
    h2 { font-size: 1.25rem; }

    /* --- Strona główna --- */
    .home-hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }

    /* --- Logowanie / rejestracja --- */
    .auth-card {
        padding: 1.5rem 1.2rem 1.2rem;
        margin: 0.5rem;
    }
    .auth-title {
        font-size: 1.6rem;
    }
    .auth-logo-icon {
        font-size: 2rem;
    }

    /* --- Karty z formularzami --- */
    .diary-section-body {
        padding: 1rem;
    }

    /* --- Nagłówki widoków (wróć + tytuł + akcja) --- */
    .page-header-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    /* --- Wpisy pamiętnika --- */
    .diary-entry-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .diary-entry-actions {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .diary-entry-actions a,
    .diary-entry-actions button {
        flex: 1 1 auto;
        text-align: center;
    }

    /* --- Szczegóły wpisu: obrazy --- */
    .detail-block-images {
        flex-direction: column;
        align-items: stretch;
    }
    .detail-block-img {
        width: 100%;
        height: auto;
        max-height: 300px;
        object-fit: cover;
    }
    .detail-block-carousel .carousel-inner {
        max-height: 260px;
    }

    /* --- Edytor bloków --- */
    .editor-block-header {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .block-datetime-input {
        max-width: 100%;
        width: 100%;
        font-size: 0.8rem;
    }

    /* --- Input daty (Create/Edit wpisu) --- */
    .date-input-field {
        max-width: 100% !important;
        width: 100%;
    }

    /* --- Paginacja --- */
    .pagination-bar {
        gap: 0.6rem;
    }
    .pagination-size {
        display: none;
    }
    .pg-btn {
        min-width: 40px;
        height: 40px;
    }

    /* --- Wyszukiwarka + przyciski --- */
    .diary-search-input {
        font-size: 1rem;
    }

    /* --- Kalendarz --- */
    .gcal-month-title {
        font-size: 1.1rem;
    }
    .gcal-header {
        gap: 0.4rem;
        flex-wrap: wrap;
        padding: 0.7rem 0.8rem;
    }
    .gcal-header-spacer {
        display: none;
    }
    .gcal-day {
        min-height: 56px;
        padding: 0.2rem;
    }
    .gcal-day-number {
        font-size: 0.72rem;
    }
    .gcal-event {
        font-size: 0.6rem;
        padding: 1px 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .gcal-add-link {
        display: none;
    }
    .gcal-event-row {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    /* --- Chat pokój --- */
    .chat-sidebar-header h3,
    .chat-main-header h2 {
        font-size: 1rem;
    }
    .chat-window {
        min-height: 280px;
        max-height: 55vh;
    }
    .chat-input {
        font-size: 1rem;
    }
    .chat-users-section {
        max-height: 120px;
    }

    /* --- Chat lista pokojów: tabela --- */
    .table thead th:nth-child(2) {
        display: none;
    }
    .table tbody td:nth-child(2) {
        display: none;
    }

    /* --- Profil --- */
    .profile-email-row {
        padding: 0.6rem 0.8rem;
    }
}
