/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: scale(.9)
    }

    to {
        opacity: 1;
        transform: scale(1)
    }
}

@keyframes shimmer {
    0% {
        background-position: 200%0
    }

    to {
        background-position: -200%0
    }
}

@keyframes fadeInImage {
    0% {
        opacity: .5;
        transform: scale(.95)
    }

    to {
        opacity: 1;
        transform: scale(1)
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ========================================
   MODALS & OVERLAYS
   ======================================== */

body.journal-page.locked .modal-overlay#passwordOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, .8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
    margin: 0;
    padding: 0
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal {
    background-color: var(--highlight-accent, #f5f5f5);
    padding: 2rem;
    border-radius: var(--border-radius, 8px);
    box-shadow: var(--shadow-medium, 0 4px 8px rgba(0, 0, 0, 0.2));
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
    margin: 0;
    animation: fadeIn .3s ease
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal h2 {
    font-size: var(--font-size-h2, 1.5rem);
    color: var(--text-primary, #333);
    margin: 0 0 1.2rem 0;
    font-family: "Adobe Garamond Regular", serif;
    line-height: 1.2
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal .form-group {
    margin: 0 0 1.5rem 0;
    padding: 0
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal .form-group label {
    display: block;
    margin: 0 0 .5rem 0;
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-primary, #333);
    font-size: var(--font-size-base, 1rem);
    font-family: "Adobe Garamond Regular", serif;
    line-height: 1.2
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal .form-group input {
    width: 100%;
    max-width: 100%;
    padding: .75rem;
    border: 1px solid var(--accent-gray, #ccc);
    border-radius: var(--border-radius, 8px);
    background-color: var(--highlight-accent, #f5f5f5);
    color: var(--text-primary, #333);
    font-family: "Adobe Garamond Regular", serif;
    font-size: var(--font-size-base, 1rem);
    box-sizing: border-box;
    margin: 0;
    transition: border-color .3s ease, box-shadow .3s ease
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal .form-group input:focus {
    outline: 0;
    border-color: var(--text-primary, #333);
    box-shadow: 0 0 4px rgba(51, 51, 51, .3)
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal button {
    background-color: var(--text-primary, #333);
    color: var(--highlight-accent, #f5f5f5);
    border: 0;
    padding: .75rem 1.5rem;
    border-radius: var(--border-radius, 8px);
    cursor: pointer;
    font-size: var(--font-size-base, 1rem);
    font-family: "Adobe Garamond Regular", serif;
    display: inline-block;
    margin: 0;
    transition: background-color .3s ease, transform .3s ease
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal button:hover,
body.journal-page.locked .modal-overlay#passwordOverlay .modal button:focus {
    background-color: var(--hover-color);
    transform: translateY(-2px);
    outline: 0
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal .error {
    padding: .5rem;
    border-radius: var(--border-radius, 8px);
    margin: 1rem 0 0 0;
    text-align: center;
    font-size: var(--font-size-sm, 0.875rem);
    background-color: rgba(255, 0, 0, .1);
    color: red;
    font-family: "Adobe Garamond Regular", serif;
    display: none
}

body.journal-page.locked .modal-overlay#passwordOverlay .modal .error.visible {
    display: block
}

body.journal-page.locked .journal-content.blurred {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
    opacity: .9;
    transition: filter .3s ease, opacity .3s ease;
    margin: 0;
    padding: 0
}

body.journal-page.locked .journal-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh
}

body.journal-page.locked .journal-content.blurred .right-column {
    position: fixed;
    top: 0;
    right: 0;
    width: 20%;
    height: 100%;
    background: linear-gradient(to bottom, #8f8f8f, #848685);
    z-index: 0;
    overflow: hidden;
    margin: 0;
    padding: 0
}

body.journal-page.locked .journal-content.blurred .right-column img {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 95%;
    height: auto;
    object-fit: contain;
    object-position: bottom;
    filter: blur(8px);
    opacity: .9;
    margin: 0;
    padding: 0
}

body.journal-page.locked {
    overflow: hidden;
    height: 100vh;
    position: fixed;
    width: 100%;
    margin: 0;
    padding: 0
}

.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, .7);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 80%;
    display: flex;
    justify-content: center;
    align-items: center
}

.image-modal img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    border: 2px solid var(--accent-gray);
    padding: 4px
}

.image-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: var(--text-primary);
    color: var(--highlight-accent);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background-color var(--transition-default);
}

.image-modal-close:hover,
.image-modal-close:focus {
    background-color: var(--hover-color);
    outline: 0
}

.image-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, .1);
    border: 0;
    cursor: pointer;
    padding: .75rem;
    border-radius: 8px;
    transition: background-color var(--transition-default);
}

.image-modal-nav svg {
    width: 32px;
    height: 32px;
    fill: var(--highlight-accent);
    transition: fill var(--transition-default);
}

.image-modal-nav:hover,
.image-modal-nav:focus {
    background: rgba(0, 0, 0, .3);
    outline: 0
}

.image-modal-prev {
    left: -4rem
}

.image-modal-next {
    right: -4rem
}

.image-modal-thumbnails {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: .5rem;
    max-width: 90%;
    scrollbar-width: thin;
    background: rgba(0, 0, 0, .3)
}

.image-modal-thumbnails img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color var(--transition-default);
}

.image-modal-thumbnails img.active {
    border: 5px solid var(--highlight-accent);
}

.image-modal-thumbnails img:hover,
.image-modal-thumbnails img:focus {
    border: 3px dotted var(--highlight-accent);
    outline: 0
}

.confirmation-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, .5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center
}

.delete-confirmation {
    position: relative;
    background-color: var(--highlight-accent);
    border: 1px solid var(--accent-gray);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    z-index: 1000;
    min-width: 300px;
    max-width: 400px
}

.confirmation-content {
    padding: 1.5rem
}

.confirmation-text {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    text-align: center
}

.confirmation-text strong {
    color: var(--text-primary);
    font-weight: var(--font-weight-bold);
}

.confirmation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center
}

.btn-confirm-delete,
.btn-cancel-delete {
    padding: .75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: all var(--transition-default);
    border: 1px solid var(--accent-gray);
    min-width: 80px
}

.btn-confirm-delete {
    background-color: #f44;
    color: var(--highlight-accent);
    border-color: #f44
}

.btn-confirm-delete:hover {
    background-color: #c00;
    border-color: #c00;
    box-shadow: var(--shadow-light);
}

.btn-cancel-delete {
    background-color: transparent;
    color: var(--text-primary);
}

.btn-cancel-delete:hover {
    background-color: var(--text-primary);
    color: var(--highlight-accent);
    border-color: var(--text-primary);
    box-shadow: var(--shadow-light);
}

/* ========================================
   UTILITIES & COMPONENTS
   ======================================== */

.success,
.error {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    text-align: center;
    font-size: var(--font-size-base);
    position: relative;
    transition: opacity .5s ease-out
}

.success {
    background-color: rgba(0, 128, 0, .15);
    color: green;
    border-left: 4px solid green
}

.error {
    background-color: rgba(255, 0, 0, .15);
    color: red;
    border-left: 4px solid red
}

.message-dismiss {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: 0 0;
    border: 0;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color var(--transition-default);
    opacity: .7;
    min-width: 44px;
    min-height: 44px
}

.message-dismiss:hover {
    background-color: rgba(0, 0, 0, .1);
    opacity: 1
}

.success .message-dismiss:hover {
    background-color: rgba(0, 0, 0, .1)
}

.error .message-dismiss:hover {
    background-color: rgba(255, 255, 255, .2)
}

.delete-link {
    background-color: transparent;
    color: #ff0000;
    text-decoration: none;
    border-radius: var(--border-radius);
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    transition: all var(--transition-default);
    border: none;
    position: absolute;
    top: -8px;
    right: -8px;
}

.delete-link:hover {
    background-color: transparent;
    transform: none;
}

.delete-link:hover svg {
    filter: drop-shadow(0 0 8px #ff0000);
}

.delete-link svg {
    fill: #ff0000;
    width: 16px;
    height: 16px;
    transition: filter var(--transition-default);
}

button,
.btn-secondary {
    background-color: var(--text-primary);
    color: var(--highlight-accent);
    border: 0;
    padding: .75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background-color var(--transition-default), transform var(--transition-default);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--hover-color);
    transform: translateY(-2px);
    outline: 0
}

.back-to-top {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background-color: var(--text-primary);
    color: var(--highlight-accent);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-default), transform var(--transition-default);
    z-index: 999
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0)
}

.back-to-top:hover,
.back-to-top:focus {
    background-color: var(--hover-color);
    outline: 0
}

.back-to-top svg {
    width: 20px;
    height: 20px;
    fill: var(--highlight-accent);
}

footer {
    text-align: center;
    padding: 1rem;
    background-color: transparent;
    box-shadow: var(--shadow-light);
    position: relative;
    z-index: 1
}

footer p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

#sentinel {
    min-height: 1px
}

