html {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background-color: white;
    background-image: url(images/cat.png);
    display: flex;
    flex-direction: column;
}

.container {
    text-align: center;
    flex: 1;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.buttons button {
    padding: 10px 20px;
    margin: 10px;
    font-size: 16px;
    cursor: pointer;
}

/* Footer styles: moves with content */
.site-footer {
    width: 100%;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 0;
    font-size: 14px;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    margin-top: auto; /* Push footer to bottom of content */
}

.site-footer .footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
    line-height: 1.6;
}

.site-footer a { 
    color: #fff; 
    text-decoration: none;
    padding: 2px 5px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.site-footer a:hover {
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    color: #fff;
}

/* Push up content so footer doesn't overlap when content is centered vertically */
.container { 
    padding-bottom: 80px; 
    min-height: calc(100vh - 120px); /* Ensure content fills viewport minus footer height */
}

/* Read page cards */
.gallery { 
    max-width: 1100px; 
    margin: 0 auto; 
    padding: 20px 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    box-sizing: border-box;
}
.confession-card {
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: #fff;
    padding: 18px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    box-sizing: border-box;
    word-break: break-word;
    width: 100%;
}
.confession-card .timestamp { display:block; font-size:12px; color:#666; margin-top:8px; }

.confession-card .preview {
    display: -webkit-box;
    -webkit-line-clamp: 4; /* show 4 lines then ellipsis */
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 16px;
    color: #222;
    line-height: 1.4;
    margin-bottom: 10px;
}

.confession-card .more { background: #444; color:#fff; border:none; padding:8px 10px; cursor:pointer; border-radius:4px; }

/* Card footer for actions */
.card-footer { display:flex; gap:8px; align-items:center; justify-content:space-between; margin-top:auto; padding-top:12px; border-top:1px dashed #eee; }
.small-btn { background:#fff; border:1px solid #ccc; padding:8px 12px; border-radius:8px; cursor:pointer; font-size:15px; }
.small-btn:hover { background:#f4f4f4; transform: translateY(-1px); }
.small-btn[disabled] { opacity:0.6; cursor:default; }
.small-btn.report { border-color:#f5c6cb; background:#fff0f1; color:#a33; }
.small-btn.report:hover { background:#ffdfe3; }
.small-btn.readmore { background:#222; color:#fff; border:none; padding:10px 14px; border-radius:8px; font-weight:700; }
.small-btn.readmore:hover { background:#000; }
.small-btn.like { display:inline-flex; gap:6px; align-items:center; }
.small-btn.like.liked { background:#ff5a5f; color:#fff; border-color:#ff5a5f; }
.card-footer .left .small-btn, .card-footer .right .small-btn { white-space:nowrap; }
.small-btn.like { min-width:90px; display:flex; align-items:center; justify-content:center; }
.small-btn.report { min-width:90px; }
.small-btn.readmore { min-width:90px; }

/* small icon style using pseudo element */
.small-btn .icon { width:14px; height:14px; display:inline-block; }
.icon-heart { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ff5a5f"><path d="M12 21s-7-4.35-9-7.07C-1.57 8.64 4.5 3 8 6.5 10 8.5 12 10 12 10s2-1.5 4-3.5C19.5 3 25.57 8.64 21 13.93 19 16.65 12 21 12 21z"/></svg>') no-repeat center/contain; }
.icon-flag { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M6 3v18h2V9h9l-2-4H8V3z"/></svg>') no-repeat center/contain; }

/* Modal */
.modal { display:none; position:fixed; left:0; right:0; top:0; bottom:0; background: rgba(0,0,0,0.6); align-items:center; justify-content:center; z-index:10000; }
.modal .box { 
    background:#fff; 
    width: min(92%, 760px); 
    padding:18px 18px 16px 18px; 
    border-radius:10px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.25); 
    position:relative;
    margin: 20px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.modal .close { position:absolute; right:12px; top:10px; font-size:20px; line-height:20px; color:#333; cursor:pointer; background:transparent; border:none; padding:6px; border-radius:6px; }
.modal .close:hover { background: rgba(0,0,0,0.04); }
.modal .modal-header { margin-bottom:8px; }
.modal .modal-header small { color:#666; display:block; font-size:13px; }
.modal .modal-header .title { font-size:20px; font-weight:700; color:#111; margin-top:6px; }
.modal .modal-body { font-size:16px; color:#222; line-height:1.45; max-height:60vh; overflow:auto; padding-right:6px; }
.modal.show .box { transform: translateY(0); opacity:1; }
.modal .box { transform: translateY(-6px); opacity:0; transition: transform 220ms ease, opacity 220ms ease; }

/* Responsive tweaks */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }
    .gallery {
        padding: 8px;
        grid-template-columns: 1fr;  /* Single column on mobile */
        gap: 12px;
        margin-top: 10px;
    }
    .confession-card {
        height: auto;
        padding: 16px;
        margin: 0;
        width: 100%;
    }
    .site-footer {
        display: none;  /* Hide footer on mobile */
    }
    input#searchInput {
        width: calc(100% - 24px) !important;
        margin: 10px 12px;
    }
    h1 {
        font-size: 24px;
        margin: 12px 0;
    }
    .modal .box {
        width: 100%;
        margin: 0 12px;
        max-height: 90vh;
    }
}

/* Write page styles */
.write-card {
    background: rgba(255,255,255,0.9);
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    max-width: 720px;
    margin: 20px auto;
}
.write-card textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    resize: vertical;
}
.write-card .actions { margin-top: 12px; display:flex; gap:12px; align-items:center; justify-content:center; }
.btn { background:#222; color:#fff; padding:10px 16px; border-radius:6px; border:none; cursor:pointer; }
.btn.secondary { background:transparent; color:#222; border:1px solid #ccc; }
.char-counter { font-size:13px; color:#666; }
.toast { position:fixed; top:20px; right:20px; background:#222; color:#fff; padding:10px 14px; border-radius:6px; display:none; z-index:12000; }

/* Improved toasts for write form */
.toast.fixed-center { left:50%; transform:translateX(-50%); top:18%; right:auto; }
.toast.show { display:block; opacity:1; transition: opacity 300ms ease, transform 300ms ease; }
.toast.success { background: linear-gradient(90deg,#2ecc71,#27ae60); color:#fff; }
.toast.error { background: linear-gradient(90deg,#e74c3c,#c0392b); color:#fff; }

@media (max-width:600px) {
    .write-card { margin: 12px; padding: 16px; }
}

/* Floating back button */
.floating-back {
    position: fixed;
    left: 18px;
    bottom: 92px; /* above footer */
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    z-index: 12000;
    text-decoration: none;
    font-size: 14px;
}
.floating-back:hover { background: rgba(0,0,0,0.95); }

/* Like button styles and animation */
.like-btn {
    background: #eee;
    border: 1px solid #ccc;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}
.like-btn:disabled { opacity: 0.6; cursor: default; }
.like-btn.liked {
    background: #ff5a5f;
    color: #fff;
    border-color: #ff5a5f;
}
.like-btn.pulse {
    animation: like-pulse 420ms cubic-bezier(.2,.8,.2,1);
}
@keyframes like-pulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.18); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}
