/* ==========================================================
   Gedenkseite Marian Mrochen - style.css
   Wuerdevolles, dunkles Design mit Kerzen-Animationen
   ========================================================== */

/* --- Custom Properties --- */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #222222;
    --bg-card: #2a2a2a;
    --bg-form: #252525;
    --text-primary: #e8e0d8;
    --text-secondary: #a89f94;
    --text-muted: #756b60;
    --accent-gold: #c9a84c;
    --accent-warm: #d4a057;
    --border-subtle: #3a3a3a;
    --border-gold: rgba(201, 168, 76, 0.3);
    --cross-color: #8b7355;
    --shadow: rgba(0, 0, 0, 0.4);
    --flame-glow: rgba(255, 153, 0, 0.25);
    --success: #6a9955;
    --error: #c94c4c;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: Georgia, 'Times New Roman', serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    caret-color: transparent;
}

input, textarea {
    caret-color: auto;
}

/* --- Header / Gedenkbereich --- */
.memorial-header {
    padding: 3rem 1.5rem 2rem;
    text-align: center;
    background: linear-gradient(180deg, #1f1f1f 0%, var(--bg-primary) 100%);
}

.header-border {
    max-width: 600px;
    margin: 0 auto;
    padding: 2.5rem 2rem 2rem;
    border: 2px solid var(--border-gold);
    position: relative;
}

.cross-symbol {
    margin-bottom: 1.5rem;
}

.cross-symbol img {
    opacity: 0.7;
    filter: brightness(0.8) sepia(0.3);
}

h1 {
    font-size: 2.5rem;
    font-weight: normal;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.life-dates {
    font-size: 1.2rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

/* --- Main Content --- */
main {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

.memorial-section {
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.memorial-section:last-child {
    border-bottom: none;
}

/* --- Danksagung --- */
.danksagung {
    text-align: center;
}

.danksagung .location {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-style: italic;
}

.danksagung h2 {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
}

.danksagung > p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.8;
}

.family {
    margin-top: 2.5rem;
}

.family > p:first-child {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.family-names {
    font-size: 1.3rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* --- Foto-Bereich --- */
.photo-section {
    text-align: center;
}

.portrait-frame {
    display: inline-block;
    border: 3px solid var(--border-gold);
    padding: 6px;
    background: var(--bg-secondary);
}

.portrait-frame img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* --- Kerzen-Formular --- */
#candle-section h2 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: normal;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
}

.candle-intro {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

#candle-form {
    max-width: 500px;
    margin: 0 auto;
    background: var(--bg-form);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

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

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.required {
    color: var(--accent-gold);
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

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

.emoji-wrapper {
    margin-top: 0.4rem;
}

.emoji-toggle {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.emoji-toggle:hover {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.emoji-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
    cursor: default;
}

.emoji-btn {
    font-size: 1.4rem;
    cursor: pointer !important;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    transition: background 0.2s, transform 0.15s;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
    display: inline-block;
}

.emoji-btn:hover {
    background: var(--border-subtle);
    transform: scale(1.2);
}

.char-count {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* Honeypot - unsichtbar fuer Menschen */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

#candle-submit {
    display: block;
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #8b6914, #c9a84c);
    color: #1a1a1a;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

#candle-submit:hover {
    opacity: 0.9;
}

#candle-submit:disabled {
    opacity: 0.5;
    cursor: wait;
}

.btn-icon {
    font-size: 1.1rem;
}

#candle-feedback {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.95rem;
    min-height: 1.5em;
}

#candle-feedback.success {
    color: var(--success);
}

#candle-feedback.error {
    color: var(--error);
}

/* --- Kerzenwand --- */
#candle-wall h2 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: normal;
    color: var(--accent-gold);
    margin-bottom: 1.5rem;
}

#candle-count {
    font-size: 1rem;
    color: var(--text-muted);
}

#candles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2rem;
}

/* --- Einzelne Kerze --- */
.candle {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    text-align: center;
    transition: border-color 0.3s;
}

.candle:hover {
    border-color: var(--border-gold);
}

/* Kerzen-Bild (animiertes WebP) */
.candle-visual {
    width: 120px;
    height: 148px;
    margin-bottom: 0.3rem;
    pointer-events: none;
    object-fit: contain;
}

.candle-name {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    word-break: break-word;
}

.candle-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 0.3rem;
    word-break: break-word;
}

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

/* Load more Button */
.btn-secondary {
    display: block;
    margin: 2rem auto 0;
    padding: 0.6rem 1.5rem;
    background: transparent;
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

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

/* --- Kerzen-Aktionen (Bearbeiten/Loeschen) --- */
.candle-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.btn-edit,
.btn-delete {
    margin-top: 0.5rem;
    padding: 0.25rem 0.6rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.btn-edit:hover {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.btn-delete:hover {
    color: var(--error);
    border-color: var(--error);
}

/* --- Inline-Bearbeiten-Formular --- */
.edit-form {
    width: 100%;
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border-subtle);
}

.edit-form input,
.edit-form textarea {
    width: 100%;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.4rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
}

.edit-form input:focus,
.edit-form textarea:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.edit-form textarea {
    resize: vertical;
    min-height: 50px;
}

.edit-buttons {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.btn-save {
    flex: 1;
    padding: 0.3rem;
    background: var(--accent-gold);
    color: var(--bg-primary);
    border: none;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
}

.btn-save:hover {
    opacity: 0.9;
}

.btn-cancel {
    flex: 1;
    padding: 0.3rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-cancel:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.edit-feedback {
    text-align: center;
    font-size: 0.8rem;
    margin-top: 0.3rem;
    min-height: 1em;
}

.edit-feedback.error {
    color: var(--error);
}

/* --- Kein-Kerzen-Hinweis --- */
.no-candles {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem 0;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer nav {
    margin-top: 0.5rem;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

footer a:hover {
    color: var(--accent-gold);
}

footer .sep {
    margin: 0 0.5rem;
    color: var(--border-subtle);
}

/* --- Responsive --- */
@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }

    .life-dates {
        font-size: 1rem;
    }

    .header-border {
        padding: 1.5rem 1rem;
    }

    .family-names {
        font-size: 1.1rem;
    }

    #candle-form {
        padding: 1.2rem;
    }

    #candles-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.8rem;
    }

    .candle {
        padding: 1rem 0.7rem 0.7rem;
    }
}

/* --- Print --- */
@media print {
    body {
        background: white;
        color: black;
    }

    .memorial-header {
        background: none;
    }

    .header-border {
        border-color: #333;
    }

    h1, .life-dates, .family-names, .danksagung h2 {
        color: black;
    }

    #candle-section,
    #candle-wall,
    footer nav {
        display: none;
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .candle-flame {
        animation: none;
    }

    html {
        scroll-behavior: auto;
    }
}
