/* Guestbook Button in Social Links */
#guestbook-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: inherit;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: color 0.3s ease;
    line-height: 1;
    vertical-align: baseline;
}

#guestbook-btn:hover {
    color: var(--accent);
}

[data-theme="terminal"] #guestbook-btn {
    color: var(--text-muted);
}

[data-theme="terminal"] #guestbook-btn:hover {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

/* Modal Overlay */
.guestbook-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.guestbook-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Modal Dialog */
.guestbook-modal {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.guestbook-overlay.open .guestbook-modal {
    transform: scale(1) translateY(0);
}

[data-theme="terminal"] .guestbook-modal {
    border-radius: 0;
    border: 1px solid var(--accent);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.1);
}

/* Modal Header */
.guestbook-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.guestbook-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

[data-theme="terminal"] .guestbook-header h2 {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 1rem;
}

.guestbook-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.guestbook-close:hover {
    color: var(--text-main);
}

/* Form Section (Left) */
.guestbook-form-section {
    padding: 1.5rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.guestbook-form-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.guestbook-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group input:disabled,
.form-group textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

[data-theme="terminal"] .form-group input,
[data-theme="terminal"] .form-group textarea {
    border-radius: 0;
    background: transparent;
    border: 1px solid var(--border-color);
}

[data-theme="terminal"] .form-group input:focus,
[data-theme="terminal"] .form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-dim);
}

.form-buttons {
    display: flex;
    gap: 0.5rem;
}

.guestbook-submit {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex: 1;
}

.guestbook-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.guestbook-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.guestbook-cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.guestbook-cancel:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}

[data-theme="terminal"] .guestbook-submit {
    border-radius: 0;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

[data-theme="terminal"] .guestbook-submit:hover {
    background: var(--accent);
    color: var(--bg-color);
}

[data-theme="terminal"] .guestbook-cancel {
    border-radius: 0;
}

/* User's Entry Display */
.guestbook-user-entry {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--accent-dim);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.guestbook-user-entry h4 {
    font-size: 0.85rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.user-entry-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.user-entry-status .approved {
    color: #22c55e;
}

.user-entry-status .pending {
    color: #f59e0b;
}

.user-entry-message {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.user-entry-actions {
    display: flex;
    gap: 0.5rem;
}

.user-entry-actions button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-entry-actions button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.user-entry-actions .delete-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
}

[data-theme="terminal"] .guestbook-user-entry {
    border-radius: 0;
}

[data-theme="terminal"] .user-entry-actions button {
    border-radius: 0;
}

/* Messages Section (Right) */
.guestbook-messages-section {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.guestbook-messages-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.guestbook-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.guestbook-entry {
    padding: 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.guestbook-entry:hover {
    border-color: var(--accent);
}

.guestbook-entry.own-entry {
    border-color: var(--accent);
    background: var(--accent-dim);
}

[data-theme="terminal"] .guestbook-entry {
    border-radius: 0;
}

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

.entry-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
}

.entry-name a {
    color: inherit;
    text-decoration: none;
}

.entry-name a:hover {
    color: var(--accent);
}

.entry-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

.entry-source {
    display: block;
    margin-top: 0.25rem;
}

.entry-source a {
    color: var(--text-muted);
    text-decoration: none;
}

.entry-source a:hover {
    color: var(--accent);
}

.entry-message {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
}

.guestbook-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.9rem;
}

.guestbook-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.guestbook-error {
    text-align: center;
    color: #ef4444;
    padding: 1rem;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .guestbook-modal {
        grid-template-columns: 1fr;
        max-height: 90vh;
    }

    .guestbook-form-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .guestbook-messages-section {
        max-height: 40vh;
    }
}
