/* 
 * Memorial Guestbook Styles
 * A refined, contemplative dark theme
 */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #161616;
    --text-primary: #e8e4df;
    --text-secondary: #9a9590;
    --text-muted: #5a5550;
    --accent: #c4a35a;
    --accent-dim: #8a7340;
    --border: #2a2825;
    --success: #4a7c59;
    --error: #8b4049;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Cormorant Garamond', 'Noto Sans Thai', Georgia, serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Audio Overlay */
#audio-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    transition: opacity 0.8s ease;
}

#audio-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    animation: pulse 3s ease-in-out infinite;
}

.candle-icon {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dhamma-cakra-icon {
    width: 120px;
    height: 120px;
    max-width: 100%;
    filter: grayscale(30%);
    opacity: 0.9;
}

.overlay-text {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.overlay-text-sub {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Language Selector */
.language-selector {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 2rem;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 999;
    transition: transform 0.3s ease-in-out;
}

.language-selector.hidden {
    transform: translateY(-100%);
}

.lang-link {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    letter-spacing: 0.1em;
    min-width: 60px;
    text-align: center;
    display: inline-block;
}

.lang-link:hover {
    color: var(--text-primary);
    border-color: var(--accent-dim);
    background: rgba(196, 163, 90, 0.1);
}

.lang-link.active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(196, 163, 90, 0.15);
    font-weight: 500;
}

/* Container */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 4rem 2rem;
    padding-top: 7.5rem;
    padding-bottom: 5rem;
    opacity: 0;
    animation: fadeIn 1.2s ease 0.3s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Memorial Header */
.memorial-header {
    text-align: center;
    margin-bottom: 4rem;
    margin-top: 0;
}

.photo-frame {
    width: 320px;
    height: 320px;
    max-width: 100%;
    margin: 0 auto 2.5rem;
    padding: 8px;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    position: relative;
}

.photo-frame::before {
    content: '';
    position: absolute;
    inset: -1px;
    border: 1px solid var(--accent-dim);
    opacity: 0.3;
}

.memorial-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1.05);
    transition: filter 0.6s ease;
    max-width: 100%;
    height: auto;
}

.memorial-photo:hover {
    filter: grayscale(80%) contrast(1.02);
}

.memorial-title {
    font-size: 2.25rem;
    font-weight: 300;
    letter-spacing: 0.03em;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    max-width: 100%;
}

.memorial-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
    line-height: 1.6;
    max-width: 100%;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 3rem 0;
    gap: 1.5rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.divider-ornament {
    color: var(--accent-dim);
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Audio Footer - Sticky at Bottom */
.audio-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.audio-btn {
    width: 100%;
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 1.25rem 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-family: inherit;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    letter-spacing: 0.05em;
}

.audio-btn:hover {
    background: rgba(196, 163, 90, 0.1);
    color: var(--text-primary);
    border-top-color: var(--accent-dim);
}

.audio-btn.playing .audio-icon {
    animation: musicPulse 1s ease infinite;
}

@keyframes musicPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Section Titles */
.section-title {
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
    margin-bottom: 2rem;
}

/* Form Section */
.guestbook-form-section {
    margin-bottom: 4rem;
}

.guestbook-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.03em;
    position: relative;
}

.password-group {
    position: relative;
}

.hint-checkbox {
    display: none;
}

.hint {
    height: 34px;
    width: 34px;
    color: var(--text-primary);
    background-color: var(--bg-card);
    border-radius: 17px;
    position: absolute;
    right: 0;
    top: 0;
    transition: 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    border: 2px solid var(--accent-dim);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.hint:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent);
}

.hint-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    width: 100%;
    height: 100%;
}

.hint-icon svg {
    display: block;
    stroke: var(--text-primary);
    flex-shrink: 0;
}

.hint > .hint-content {
    overflow: hidden;
    max-height: 0px;
    transition: max-height 0.3s ease;
    transition-delay: 0.1s;
    padding: 0;
    opacity: 0;
    color: var(--text-primary);
    font-size: 0.85rem;
    position: absolute;
    top: 35px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    min-width: 250px;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.hint-content strong {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--accent);
    font-size: 0.9rem;
    padding: 1rem 1rem 0.5rem 1rem;
}

.password-hint-text {
    padding: 0 1rem 1rem 1rem;
    margin: 0;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.hint-checkbox:checked + label + .hint {
    height: auto;
    width: auto;
    min-width: 250px;
    max-width: 350px;
    border-radius: 4px;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.hint-checkbox:checked + label + .hint > .hint-content {
    max-height: 999px;
    opacity: 1;
    padding: 0;
    position: relative;
    top: 0;
    right: 0;
}

.hint-checkbox:checked + label + .hint > .hint-icon {
    display: none;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-dim);
    background: var(--bg-card);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

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

.submit-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: transparent;
    border: 1px solid var(--accent-dim);
    color: var(--accent);
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.submit-btn:hover {
    background: var(--accent-dim);
    color: var(--bg-primary);
}

/* Messages */
.message {
    text-align: center;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.message-error {
    background: rgba(139, 64, 73, 0.15);
    border: 1px solid var(--error);
    color: #d4868f;
}

.message-success {
    background: rgba(74, 124, 89, 0.15);
    border: 1px solid var(--success);
    color: #7db38d;
}

/* Messages List */
.messages-section {
    margin-bottom: 4rem;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message-card {
    padding: 2rem;
    background: var(--bg-card);
    border-left: 2px solid var(--accent-dim);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.message-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.message-text {
    font-size: 1.1rem;
    font-style: italic;
    line-height: 1.8;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.message-author {
    font-size: 0.95rem;
    color: var(--accent);
    font-weight: 400;
}

.message-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Footer */
.memorial-footer {
    text-align: center;
    padding-top: 2rem;
}

.footer-text {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.footer-text-thai {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Responsive */
/* Desktop - ensure proper spacing for language selector */
@media (min-width: 769px) {
    .container {
        padding-top: 8rem;
    }
}

/* Tablet and smaller */
@media (max-width: 768px) {
    .language-selector {
        gap: 1.5rem;
        padding: 1.25rem 1.5rem;
    }

    .lang-link {
        font-size: 1.35rem;
        padding: 0.65rem 1.25rem;
        min-width: 55px;
    }

    .container {
        padding: 3rem 1.5rem;
        padding-top: 5.5rem;
        padding-bottom: 5rem;
    }

    .memorial-title {
        font-size: 2rem;
    }

    .memorial-subtitle {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.35rem;
    }

    .divider {
        margin: 2.5rem 0;
    }
}

/* Mobile devices */
@media (max-width: 600px) {
    html {
        font-size: 15px;
    }

    .language-selector {
        gap: 1.25rem;
        padding: 1rem 1.25rem;
    }

    .lang-link {
        font-size: 1.25rem;
        padding: 0.6rem 1rem;
        min-width: 50px;
    }

    .container {
        padding: 2.5rem 1.25rem;
        padding-top: 5rem;
        padding-bottom: 5rem;
    }

    .memorial-header {
        margin-bottom: 3rem;
    }

    .memorial-title {
        font-size: 1.75rem;
        letter-spacing: 0.05em;
    }

    .memorial-subtitle {
        font-size: 0.95rem;
    }

    .photo-frame {
        width: 260px;
        height: 260px;
        margin-bottom: 2rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .section-subtitle {
        font-size: 0.9rem;
    }

    .guestbook-form-section {
        margin-bottom: 3rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }

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

    .submit-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }

    .message-card {
        padding: 1.5rem;
    }

    .message-text {
        font-size: 1rem;
        line-height: 1.7;
    }

    .message-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .audio-footer {
        border-top-width: 1px;
    }

    .audio-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .divider {
        margin: 2rem 0;
        gap: 1rem;
    }

    .footer-text {
        font-size: 0.95rem;
    }

    .footer-text-thai {
        font-size: 0.9rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .language-selector {
        gap: 1rem;
        padding: 0.875rem 1rem;
    }

    .lang-link {
        font-size: 1.15rem;
        padding: 0.55rem 0.875rem;
        min-width: 45px;
    }

    .container {
        padding: 2rem 1rem;
        padding-top: 4.5rem;
        padding-bottom: 4.5rem;
    }

    .memorial-title {
        font-size: 1.5rem;
    }

    .photo-frame {
        width: 230px;
        height: 230px;
    }

    .section-title {
        font-size: 1.15rem;
    }

    .overlay-text {
        font-size: 1.25rem;
    }

    .overlay-text-sub {
        font-size: 0.9rem;
    }

    .candle-icon {
        margin-bottom: 1.5rem;
    }

    .dhamma-cakra-icon {
        width: 90px;
        height: 90px;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.75rem 0.875rem;
    }

    .message-card {
        padding: 1.25rem;
    }

    .audio-btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
    }
}

/* Very small devices */
@media (max-width: 360px) {
    .language-selector {
        gap: 0.75rem;
        padding: 0.75rem 0.875rem;
    }

    .lang-link {
        font-size: 1.05rem;
        padding: 0.5rem 0.75rem;
        min-width: 40px;
    }

    .audio-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .container {
        padding: 1.5rem 0.875rem;
        padding-top: 4rem;
        padding-bottom: 4.5rem;
    }

    .memorial-title {
        font-size: 1.35rem;
    }

    .photo-frame {
        width: 200px;
        height: 200px;
    }
}

/* Print styles */
@media print {
    #audio-overlay,
    .audio-footer,
    .guestbook-form-section {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .message-card {
        opacity: 1;
        transform: none;
        border-color: #333;
        page-break-inside: avoid;
    }
}
