/* --- AIIMS KALYANI: SAMSUNG COMPATIBLE VERSION --- */
:root {
    --bg: #000000;
    --card: #121212;
    --border: #222222;
    --text-main: #ffffff;
    --text-muted: #888888;
    --primary: #bb86fc;
    --accent: #03dac6;
    --warning: #ffc107;
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0; padding: 0; width: 100%; 
    background: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    
    /* --- THE FIX FOR OLD PHONES --- */
    height: 100vh;        /* Fallback for old Samsung/Chrome */
    height: 100dvh;       /* Modern phones */
    overflow: hidden;     /* Stop the whole page from bouncing */
    position: fixed;      /* Locks the frame in place */
}

.app-container {
    width: 100%;
    max-width: 500px;
    height: 100%;         /* Fills the fixed body */
    margin: 0 auto;       /* Centers it */
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    position: relative;
}

/* HEADER */
.sticky-header {
    flex-shrink: 0;
    padding: 15px 20px;
    padding-top: max(15px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.95);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    height: 70px;
}
.brand-title { font-size: 18px; font-weight: 800; letter-spacing: 0.5px; }
.status-text { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.sort-hint { font-size: 10px; color: var(--accent); font-weight: bold; border: 1px solid #333; padding: 4px 8px; border-radius: 10px; margin-right: 8px; }
.refresh-btn { background: transparent; border: 1px solid var(--border); color: var(--text-main); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; }

/* MAIN CONTENT (The part that scrolls) */
#app-core {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Critical for older flexbox engines */
}

/* PENDING SECTION */
.pending-section { border-bottom: 1px solid var(--border); background: #0a0a0a; padding: 10px 0; flex-shrink: 0; }
.pending-label { padding: 0 15px; font-size: 10px; font-weight: 800; color: var(--warning); margin-bottom: 8px; letter-spacing: 1px; }
.horizontal-scroll { display: flex; overflow-x: auto; gap: 10px; padding: 0 15px; scrollbar-width: none; }
.horizontal-scroll::-webkit-scrollbar { display: none; }
.pending-card { flex: 0 0 200px; background: #1a1a1a; border: 1px dashed var(--warning); border-radius: 8px; padding: 10px; font-size: 12px; height: 80px; overflow: hidden; }

/* FEED SECTION */
.feed-section {
    flex: 1;
    overflow-y: scroll; /* Force scroll capability */
    -webkit-overflow-scrolling: touch; /* Smooth iOS scroll */
    padding: 15px;
    padding-bottom: 20px;
}
.feed-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; animation: slideUp 0.3s ease-out; cursor: pointer; transition: background 0.2s; }
.feed-item:active { background: #1a1a1a; }

.meta-header { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.category-badge { color: var(--primary); background: rgba(187, 134, 252, 0.1); padding: 2px 8px; border-radius: 4px; }
.content-body { font-size: 15px; line-height: 1.5; color: #eee; margin-bottom: 12px; word-wrap: break-word; }
.action-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.05); }

/* VOTE CONTROLS */
.vote-controls { display: flex; align-items: center; gap: 10px; }
.vote-btn { background: none; border: none; color: #666; font-size: 16px; padding: 5px; cursor: pointer; z-index: 5; }
.vote-count { font-weight: bold; color: #eee; font-size: 12px; }

/* COMMENTS MODAL */
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 100; display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(2px); }
.comment-box { width: 100%; max-width: 500px; height: 50vh; background: #121212; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; border-top: 1px solid var(--border); animation: slideUp 0.3s; box-shadow: 0 -5px 20px rgba(0,0,0,0.5); }
.comment-header { padding: 10px 15px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.comment-header h3 { font-size: 14px; margin: 0; }
.comment-list { flex: 1; overflow-y: auto; padding: 15px; }
.single-comment { margin-bottom: 10px; font-size: 13px; border-bottom: 1px solid #222; padding-bottom: 8px; }
.comment-input-area { padding: 10px; border-top: 1px solid var(--border); display: flex; gap: 8px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: #000; }
#commentInput { flex: 1; background: #222; border: none; padding: 8px 12px; border-radius: 20px; color: white; font-size: 13px; }
.send-btn-small { background: var(--accent); color: black; border: none; width: 30px; height: 30px; border-radius: 50%; font-weight: bold; font-size: 12px; }
.close-btn { background: none; border: none; color: white; font-size: 20px; padding: 5px; }

/* POST INPUT */
.post-section { flex-shrink: 0; border-top: 1px solid var(--border); background: #000; padding: 10px 15px; padding-bottom: max(15px, env(safe-area-inset-bottom)); z-index: 60; }
.post-wrapper { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 10px; }
.input-row { display: flex; gap: 10px; align-items: center; }
.minimal-select { width: 100%; background: transparent; border: none; color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; margin-bottom: 5px; }
textarea { flex: 1; background: transparent; border: none; color: white; font-size: 16px; resize: none; height: 40px; padding: 8px 0; }
.send-btn { background: var(--text-main); color: black; border: none; width: 34px; height: 34px; border-radius: 50%; font-weight: bold; display: flex; align-items: center; justify-content: center; }

/* UTILS */
.hidden { display: none !important; }
.admin-actions { display: flex; gap: 5px; margin-top: 5px; }
.btn-act { flex: 1; padding: 4px; font-size: 10px; font-weight: bold; border-radius: 4px; border: 1px solid transparent; cursor: pointer; }
.btn-approve { background: rgba(3, 218, 198, 0.2); color: var(--accent); border-color: var(--accent); }
.btn-reject { background: rgba(207, 102, 121, 0.2); color: #cf6679; border-color: #cf6679; }

/* LOGIN */
.login-box { background: var(--card); padding: 30px; border-radius: 16px; border: 1px solid var(--border); width: 85%; max-width: 300px; text-align: center; }
.admin-input { background: #000; border: 1px solid #333; color: white; padding: 15px; width: 100%; text-align: center; margin-bottom: 20px; font-weight: bold; letter-spacing: 3px; border-radius: 8px; font-size: 16px; }
.btn-login { width: 100%; background: var(--text-main); border: none; padding: 12px; font-weight: bold; border-radius: 6px; cursor: pointer; }
.btn-cancel { background: none; border: none; color: #666; margin-top: 15px; cursor: pointer; font-size: 12px; }
footer { margin-top: 10px; text-align: center; padding-bottom: 5px; }
.simple-admin-link { color: #333; text-decoration: none; font-size: 10px; font-weight: bold; }

@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }