/* Floating Actions CSS */

/* Floating Action Stack */
.floating-action-stack {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1000;
}

.floating-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    /* background: linear-gradient(135deg, #181818e7 0%, #181818b6 100%); */
    background: #2d2d2d;
    backdrop-filter: blur(10px);
    color: white;
}

.floating-btn:hover {
    background: #000;
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
    color: white;
    text-decoration: none;
}

.floating-btn svg {
    transition: transform 0.3s ease;
}

.floating-editor-btn:hover svg {
    transform: rotate(90deg);
}

/* Scroll to Top Button */
.floating-scroll-top-btn {
    transition: all 0.3s ease;
    /* opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.floating-scroll-top-btn.visible { */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.floating-scroll-top-btn:hover svg {
    transform: translateY(-2px);
}

/* Floating Note Button */
.floating-note-btn {
    position: relative;
    /* background: var(--primary-color, #4a5568); */
    background: #2d2d2d;
    color: white;
}

.floating-note-btn:hover {
    background: var(--accent-color, #2d3748);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 85, 104, 0.3);
}

/* Notification dot */
.note-notification-dot {
    position: absolute;
    top: 0px;
    right: 3px;
    width: 8px;
    height: 8px;
    background: #ff6b35;
    border-radius: 50%;
    /* border: 1px solid white; */
    /* animation: pulse 2s infinite; */
    z-index: 10;
}

/* @keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
} */

/* 사이드바가 열렸을 때 스택 위치 조정 */
.sidebar-open .floating-action-stack {
    right: calc(75% + 2rem);
}

/* Floating Guestbook */
.floating-guestbook {
    position: fixed;
    bottom: 2rem;
    right: -400px;
    width: 350px;
    height: 100%;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transition: right 0.3s ease;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
}

.floating-guestbook.active {
    right: 2rem;
}

.guestbook-header {
    background: #f8f9fa;
    color: #333;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0; /* 헤더가 축소되지 않도록 */
}

.guestbook-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d2d2d;
}

.guestbook-close {
    background: none;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.guestbook-close:hover {
    color: #2d2d2d;
}

.guestbook-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* flex children이 올바르게 축소되도록 */
}

.guestbook-entries {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    padding: 0;
    min-height: 0; /* flex children이 올바르게 축소되도록 */
}

.guestbook-form {
    position: relative;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e5e5;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-shrink: 0; /* 폼이 축소되지 않도록 */
}

.guestbook-form input {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background: white;
}

.guestbook-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s ease;
    background: white;
}

.name-input-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}

.name-input-container input {
    width: 50%;
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background: white;
}

.guestbook-form input:focus,
.guestbook-form textarea:focus {
    outline: none;
    border-color: #2d2d2d;
}

.guestbook-submit {
    position: absolute;
    top: 0;
    right: 14px;
    z-index: 1;
    transform: translate(0%, -72.5%);
    background: #000000;
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    height: 40px;
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;    
}

.guestbook-submit:hover {
    background: #3a3a3a;
    top: -5px;
}

.guestbook-entry {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
    margin-bottom: 0;
}

.guestbook-entry:hover {
    background: #f8f9fa;
}

.guestbook-entry:first-child {
    border-bottom: none;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.entry-name {
    font-weight: 600;
    color: #2d2d2d;
    font-size: 0.85rem;
}

.entry-date {
    font-size: 0.75rem;
    color: #666;
    margin-right: auto;
    margin-left: 5px;
}

.entry-message {
    color: #4a4a4a;
    font-size: 0.85rem;
    line-height: 1.4;
}

.entry-more-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transform: rotate(90deg);
}

.guestbook-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #666;
    height: 100%;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e5e5e5;
    border-top: 2px solid #2d2d2d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* Guestbook Infinite Scroll */
.guestbook-load-more {
    text-align: center;
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
    margin-top: 1rem;
}

.load-more-message {
    font-size: 0.875rem;
    color: #666;
    font-style: italic;
}

.guestbook-entries {
    /* max-height: 400px; */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f0f0f0;
}

.guestbook-entries::-webkit-scrollbar {
    width: 6px;
}

.guestbook-entries::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.guestbook-entries::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.guestbook-entries::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.guestbook-error {
    text-align: center;
    padding: 2rem 1rem;
    color: #666;
}

.retry-btn {
    background: var(--primary-color, #007bff);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.2s ease;
}

.retry-btn:hover {
    background: var(--primary-color-dark, #0056b3);
}

/* Top Loading Indicator */
.top-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.2rem 0.75rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.875rem;
    color: #666;
    
    /* 부드러운 애니메이션 */
    opacity: 0;
    transform: translateY(-20px);
    animation: slideDown 0.3s ease-out forwards;
}

.top-loading .loading-spinner {
    width: 16px;
    height: 16px;
}

.loading-text {
    font-size: 0.875rem;
}

/* Top Loading Container */
.top-loading-container {
    position: relative;
    z-index: 10;
    overflow: hidden; /* 애니메이션이 컨테이너 밖으로 나가지 않도록 */
}

/* 로딩 스피너 등장 애니메이션 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 로딩 스피너 사라짐 애니메이션 */
.top-loading.fade-out {
    animation: slideUp 0.25s ease-in forwards;
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}


/* =========================== */
.guestbook-empty {
    text-align: center;
    padding: 2rem 1rem;
    margin: auto;
    color: #666;
}
/* =========================== */

/* Mobile Responsive */
@media (max-width: 768px) {
    .floating-action-stack {
        bottom: 1rem;
        right: 1rem;
    }
    
    .floating-btn {
        width: 50px;
        height: 50px;
    }
    
    .floating-scroll-top-btn.visible {
        opacity: 0.9;
    }
    
    .floating-guestbook {
        width: calc(100vw - 2rem);
        right: -100vw;
        bottom: 1rem;
    }
    
    .floating-guestbook.active {
        right: .5rem;
    }
    
    /* 모바일에서 사이드바 열렸을 때는 숨김 */
    .sidebar-open .floating-action-stack {
        opacity: 0;
        pointer-events: none;
    }
    
    .sidebar-open .floating-guestbook {
        opacity: 0;
        pointer-events: none;
    }
}
@media (max-width: 480px) {
    .floating-action-stack{gap: 0.5rem;}
    .floating-btn {
        width: 45px;
        height: 45px;
    }
}