/* THE MIDNIGHT MIRROR - MASTER STYLESHEET
   Theme: Deep Midnight / Cyan Neon / Glassmorphism
*/

:root {
    --bg-deep: #050a14;
    --bg-card: #0a1221;
    --cyan-glow: #00f2ff;
    --border-soft: #1a2235;
    --text-muted: #8b949e;
    --text-main: #e6edf3;
    --danger: #ff4d4d;
    --success: #28a745;
}

/* =========================================
   GLOBAL RESET & BASE
   ========================================= */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, sans-serif;
    margin: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

/* =========================================
   LAYOUT & CONTAINERS
   ========================================= */
.container {
    max-width: 1600px; 
    margin: 0 auto;
    padding: 0 40px;
}

.home-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 60px;
    padding: 60px 0;
    align-items: start;
}

/* =========================================
   NAVIGATION
   ========================================= */
.main-nav {
    background: #0a0f1d;
    border-bottom: 1px solid #1a2235;
    padding: 1.2rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px; 
    margin: 0 auto;
    padding: 0 40px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--cyan-glow);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: bold;
}

.nav-links a:hover {
    color: var(--cyan-glow);
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 20px;
}

.register-pill {
    background: var(--cyan-glow);
    color: #000 !important;
    padding: 8px 22px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

.register-pill:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
}

/* =========================================
   TYPOGRAPHY
   ========================================= */
.glow-text {
    color: var(--cyan-glow);
    text-shadow: 0 0 15px rgba(0, 242, 255, 0.5);
}

.text-center { text-align: center; }

/* =========================================
   CARDS & COMPONENTS
   ========================================= */
.verify-box, .manifesto-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.auth-container {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    margin: 60px auto;
    width: 100%;
    max-width: 500px; 
}

.editor-page-container {
    max-width: 1520px !important; 
}

.signal-card {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    margin-bottom: 25px;
    overflow: hidden;
    transition: 0.3s;
}

.signal-card:hover {
    border-color: var(--cyan-glow);
    transform: translateX(5px);
}

.signal-thumb-container {
    width: 280px;
    min-width: 280px;
}

.signal-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.signal-content {
    padding: 25px;
}

.signal-meta {
    margin-top: 15px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =========================================
   FORMS & INPUTS
   ========================================= */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

input, select, textarea {
    width: 100%;
    padding: 14px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-soft);
    color: #fff;
    border-radius: 6px;
    font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--cyan-glow);
    box-shadow: 0 0 8px rgba(0, 242, 255, 0.2);
}

.btn-cyan {
    background: transparent;
    border: 1px solid var(--cyan-glow);
    color: var(--cyan-glow);
    padding: 14px;
    width: 100%;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.3s;
}

.btn-cyan:hover {
    background: var(--cyan-glow);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
}

/* =========================================
   QUILL EDITOR STYLES
   ========================================= */
.editor-wrapper {
    margin-top: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    overflow: hidden;
}

.ql-toolbar.ql-snow {
    background: #0d1626;
    border: none !important;
    border-bottom: 1px solid var(--border-soft) !important;
    padding: 12px !important;
}

.ql-container.ql-snow {
    background: rgba(0, 0, 0, 0.2);
    border: none !important;
    height: 650px; /* Taller editing area */
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
}

.ql-snow .ql-stroke { stroke: var(--text-muted) !important; }
.ql-snow .ql-fill { fill: var(--text-muted) !important; }
.ql-snow .ql-picker { color: var(--text-muted) !important; }

.grid-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.file-input-group {
    margin: 30px 0;
    padding: 30px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--border-soft);
    border-radius: 8px;
}

.file-input-group:hover {
    border-color: var(--cyan-glow);
}

/* =========================================
   SYSTEM TABLES & ALERTS
   ========================================= */
.admin-full-container { padding: 40px 0; }
.table-responsive { width: 100%; overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--bg-card); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 1000px; }
.admin-table th { background: #0d1626; color: var(--text-muted); text-align: left; padding: 15px; font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid var(--border-soft); }
.admin-table td { padding: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 0.9rem; }
.admin-row { background: rgba(0, 242, 255, 0.03); }

.badge { padding: 4px 10px; border-radius: 4px; font-size: 0.7rem; font-weight: bold; }
.badge.admin { background: var(--danger); color: #fff; }
.badge.user { background: #333; color: #ccc; }

.btn-sm { padding: 6px 12px; border-radius: 4px; font-size: 0.8rem; }
.btn-edit { background: var(--cyan-glow); color: #000; font-weight: bold; }

.flash-wrapper { margin-top: 20px; }
.alert { padding: 15px; border-radius: 6px; margin-bottom: 15px; text-align: center; font-weight: bold; border: 1px solid transparent; }
.alert-success { background: rgba(40, 167, 69, 0.1); color: var(--success); border-color: var(--success); }
.alert-danger { background: rgba(220, 53, 69, 0.1); color: var(--danger); border-color: var(--danger); }
.alert-info { background: rgba(0, 242, 255, 0.1); color: var(--cyan-glow); border-color: var(--cyan-glow); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   POST PAGE STYLES
   ========================================= */
.post-page-container {
    width: 100%;
    max-width: min(1480px, 100vw - 1.5rem);
    margin: 4rem auto;
    padding: 0 0.75rem;
}

@media (min-width: 1400px) {
    .post-page-container {
        max-width: min(1520px, 100vw - 2rem);
    }
}

.post-article {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 3rem;
    margin-bottom: 4rem;
}

@media (min-width: 1024px) {
    .post-article {
        padding: 4rem;
    }
}

.post-featured-image {
    width: 100%;
    max-width: 100%;
    margin: 0 0 2rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-soft);
}

.post-featured-image img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.post-header {
    margin-bottom: 2.5rem;
}

.post-title {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    margin: 0 0 2rem 0;
    line-height: 1.2;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 1.25rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item strong {
    color: var(--cyan-glow);
}

.research-extensive {
    color: #ffd700;
}

.research-moderate {
    color: #ff8c00;
}

.topic-badge {
    background: rgba(0, 242, 255, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    color: var(--cyan-glow);
}

.post-content {
    line-height: 1.8;
    font-size: clamp(1rem, 2vw, 1.1rem);
    font-family: 'Inter', -apple-system, sans-serif;
    margin-bottom: 2rem;
}

.post-content::after {
    content: "";
    display: table;
    clear: both;
}

.post-content p {
    margin-bottom: 1.25rem;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--cyan-glow);
}

.post-content img {
    max-width: 100%;
    height: auto;
    margin: 1.25rem 0;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
}

/* Image positioning support */
.post-content img.float-left {
    float: left;
    margin-right: 1.5rem;
    max-width: 45%;
}

.post-content img.float-right {
    float: right;
    margin-left: 1.5rem;
    max-width: 45%;
}

.post-content img.float-center {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .post-content img.float-left,
    .post-content img.float-right {
        float: none !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

.post-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    color: #ffab91;
}

.post-content pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border-soft);
}

/* =========================================
   MIDNIGHT MODE STYLES
   ========================================= */
.midnight-mode-btn {
    position: fixed;
    top: 100px;
    right: 40px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 242, 255, 0.1);
    border: 2px solid var(--cyan-glow);
    color: var(--cyan-glow);
    font-size: 0;
    cursor: pointer;
    transition: 0.3s;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.midnight-moon-icon {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 32%, #d8d8de 0%, #9a9aa8 42%, #5c5c68 72%, #3a3a44 100%);
    box-shadow:
        inset -3px -3px 6px rgba(0, 0, 0, 0.45),
        inset 2px 2px 4px rgba(255, 255, 255, 0.35),
        0 0 12px rgba(180, 180, 190, 0.35);
}

.midnight-mode .midnight-moon-icon {
    box-shadow:
        inset -3px -3px 6px rgba(0, 0, 0, 0.5),
        inset 2px 2px 5px rgba(255, 255, 255, 0.45),
        0 0 18px rgba(0, 242, 255, 0.35);
}

.midnight-mode-btn:hover {
    background: rgba(0, 242, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
    transform: scale(1.1);
}

.midnight-mode .post-page-container {
    background: #000 !important;
    max-width: 100%;
    margin: 0;
    padding: 0;
    width: 100%;
}

.midnight-mode .post-article,
.midnight-mode .comments-section {
    background: #000 !important;
    border-color: rgba(0, 242, 255, 0.2) !important;
    border-radius: 0;
    margin: 0;
    padding: 4rem 3rem !important;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.midnight-mode .post-title,
.midnight-mode .comments-title {
    color: var(--cyan-glow);
    text-shadow: 0 0 15px rgba(0, 242, 255, 0.5);
}

.midnight-mode .post-content,
.midnight-mode .comment-content {
    color: var(--cyan-glow);
    text-shadow: 0 0 8px rgba(0, 242, 255, 0.3);
}

.midnight-mode .post-content p,
.midnight-mode .post-content h1,
.midnight-mode .post-content h2,
.midnight-mode .post-content h3 {
    color: var(--cyan-glow);
}

.midnight-mode .post-meta,
.midnight-mode .comment-header {
    border-color: rgba(0, 242, 255, 0.2);
    color: rgba(0, 242, 255, 0.8);
}

.midnight-mode .main-nav {
    display: none;
}

/* =========================================
   COMMENTS SECTION
   ========================================= */
.comments-section {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 40px;
    animation: fadeIn 0.4s ease;
}

.comments-title {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 30px;
}

.comment-form {
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.2);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 40px;
}

.comment-form textarea {
    resize: vertical;
    min-height: 100px;
    margin-bottom: 15px;
}

.comment-form .btn-cyan {
    width: auto;
    padding: 10px 20px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 20px;
    transition: 0.3s;
}

.comment:hover {
    border-color: rgba(0, 242, 255, 0.3);
    background: rgba(0, 242, 255, 0.03);
}

.comment-pinned {
    border: 2px solid var(--cyan-glow);
    background: rgba(0, 242, 255, 0.08);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
    position: relative;
    animation: pinnedGlowPulse 2.4s ease-in-out infinite;
}

@keyframes pinnedGlowPulse {
    0%, 100% {
        box-shadow: 0 0 12px rgba(0, 242, 255, 0.15), 0 0 28px rgba(0, 242, 255, 0.08);
        border-color: rgba(0, 242, 255, 0.75);
    }
    50% {
        box-shadow: 0 0 22px rgba(0, 242, 255, 0.45), 0 0 48px rgba(0, 242, 255, 0.2);
        border-color: rgba(0, 242, 255, 1);
    }
}

.pinned-badge {
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--bg-deep);
    border: 2px solid var(--cyan-glow);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--cyan-glow);
    animation: pinnedBadgeShimmer 2.4s ease-in-out infinite;
}

@keyframes pinnedBadgeShimmer {
    0%, 100% { filter: brightness(1); text-shadow: 0 0 6px rgba(0, 242, 255, 0.35); }
    50% { filter: brightness(1.15); text-shadow: 0 0 14px rgba(0, 242, 255, 0.65); }
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.comment-author {
    color: var(--cyan-glow);
    font-size: 0.95rem;
}

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

.comment-controls {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.comment-controls button {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
}

.comment-controls button:hover {
    border-color: var(--cyan-glow);
    color: var(--cyan-glow);
}

.comment-content {
    color: var(--text-main);
    line-height: 1.6;
}

.no-comments {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.premium-prompt,
.login-prompt {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    color: #ffd700;
}

.premium-prompt a,
.login-prompt a {
    color: var(--cyan-glow);
    font-weight: bold;
    text-decoration: underline;
}

/* =========================================
   TOPIC FILTER BUTTONS
   ========================================= */
.topic-filter-buttons {
    display: flex;
    gap: 12px;
    margin: 30px 0 40px 0;
    flex-wrap: wrap;
}

.topic-btn {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.topic-btn:hover {
    border-color: var(--cyan-glow);
    color: var(--cyan-glow);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.topic-btn.active {
    background: var(--cyan-glow);
    color: #000;
    border-color: var(--cyan-glow);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
}

/* =========================================
   POST CARD LINKS
   ========================================= */
.signal-link {
    cursor: pointer;
    text-decoration: none;
}

.signal-link:hover h3 {
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 242, 255, 0.6);
}

.mini-signal-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mini-card {
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    transition: 0.3s;
}

.mini-signal-link {
    text-decoration: none;
}

.mini-card:hover {
    border-color: var(--cyan-glow);
    background: rgba(0, 242, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
    transform: translateX(5px);
}

.mini-card .date {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.mini-card p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: var(--text-main);
}

.mini-title {
    font-weight: bold;
    color: var(--cyan-glow);
}

.mini-topic {
    display: inline-block;
    font-size: 0.65rem;
    color: var(--cyan-glow);
    background: rgba(0, 242, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 8px;
}

/* =========================================
   LATEST SIGNALS (SIDEBAR)
   ========================================= */
.side-panel-signals {
    position: relative;
}

.latest-signals-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.latest-signals-title {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.08em;
}

.signals-live-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cyan-glow);
    box-shadow: 0 0 14px rgba(0, 242, 255, 0.85);
    animation: signalsLivePulse 2s ease-in-out infinite;
}

@keyframes signalsLivePulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.mini-card-signal {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0;
    padding: 0;
    overflow: hidden;
    align-items: stretch;
    position: relative;
}

.mini-card-glow {
    position: absolute;
    inset: -50% -30% auto -30%;
    height: 120%;
    background: radial-gradient(ellipse 80% 60% at 15% 20%, rgba(0, 242, 255, 0.22), transparent 55%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 0;
}

.mini-card-signal:hover .mini-card-glow {
    opacity: 1;
}

.mini-card-visual {
    position: relative;
    z-index: 1;
    border-right: 1px solid rgba(0, 242, 255, 0.18);
    min-height: 88px;
}

.mini-card-thumb {
    width: 100%;
    height: 100%;
    min-height: 88px;
    object-fit: cover;
    display: block;
}

.mini-card-body {
    position: relative;
    z-index: 1;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 88px;
}

.mini-card-signal .mini-title {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.35;
}

.mini-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: auto;
}

.mini-card-footer .mini-topic {
    margin-top: 0;
}

.mini-read {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mini-card-empty {
    grid-template-columns: 1fr;
    padding: 20px;
}

.mini-card-signal:hover {
    transform: translateY(-4px);
    border-color: var(--cyan-glow);
    background: rgba(0, 242, 255, 0.12);
    box-shadow: 0 8px 28px rgba(0, 242, 255, 0.18);
}

.no-posts {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.error-message {
    text-align: center;
    color: var(--danger);
    padding: 20px;
}

/* =========================================
   EDITOR IMPROVEMENTS
   ========================================= */
.editor-page-container {
    max-width: 1520px;
    margin: 60px auto;
    padding: 0 20px;
}

.editor-page-container h2 {
    margin-bottom: 30px;
}

.editor-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.editor-wrapper-improved {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 30px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: #0d1626;
    border-bottom: 1px solid var(--border-soft);
}

.editor-btn {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.2s;
}

.editor-btn:hover {
    border-color: var(--cyan-glow);
    color: var(--cyan-glow);
    box-shadow: 0 0 8px rgba(0, 242, 255, 0.2);
}

.editor-toolbar-img-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1 1 220px;
    margin-left: auto;
}

.editor-img-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.editor-btn-compact {
    padding: 4px 10px;
    font-size: 0.72rem;
    width: auto;
}

.editor-img-nudge-hint {
    margin: 0 12px 12px 12px;
    font-size: 0.72rem;
    color: rgba(139, 148, 158, 0.95);
    line-height: 1.45;
}

.editor-img-nudge-hint kbd {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-soft);
    background: rgba(0, 0, 0, 0.35);
    color: var(--cyan-glow);
    font-size: 0.68rem;
    font-family: inherit;
}

.editor-label {
    display: block;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    margin: 12px 12px 0 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.quill-container {
    min-height: 600px;
    background: rgba(0, 0, 0, 0.3);
}

.quill-container.preview-mode {
    cursor: default;
    pointer-events: none;
}

/* Match editor text styling to post display */
.ql-editor {
    font-family: 'Inter', -apple-system, sans-serif !important;
    font-size: clamp(1rem, 2vw, 1.1rem) !important;
    line-height: 1.8 !important;
    color: var(--text-main) !important;
    padding: 2rem 3rem !important;
}

@media (min-width: 1024px) {
    .ql-editor {
        padding: 2rem 4rem !important;
    }
}

.ql-editor::after {
    content: "";
    display: table;
    clear: both;
}

.ql-editor p {
    margin-bottom: 1.25rem !important;
}

.ql-editor h1,
.ql-editor h2,
.ql-editor h3 {
    color: var(--cyan-glow) !important;
    margin-top: 1.875rem !important;
    margin-bottom: 0.9375rem !important;
}

.ql-editor ul,
.ql-editor ol {
    margin-bottom: 1.25rem !important;
}

.ql-editor li {
    margin-bottom: 0.625rem !important;
}

.ql-editor blockquote {
    border-left: 4px solid var(--cyan-glow);
    padding-left: 1rem;
    margin: 1rem 0;
    color: rgba(0, 242, 255, 0.8);
}

.ql-editor code {
    background: rgba(0, 0, 0, 0.3) !important;
    color: #ffab91 !important;
    padding: 0.125rem 0.375rem !important;
    border-radius: 4px;
}

#reading-time-display {
    background: rgba(0, 242, 255, 0.05);
    border-color: rgba(0, 242, 255, 0.2);
    text-align: center;
    cursor: default;
}

.btn-publish {
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

/* =========================================
   DRAGGABLE IMAGE STYLES
   ========================================= */
.draggable-img-container {
    display: inline-block;
    position: relative;
    margin: 15px 0;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: 0.2s;
}

.draggable-img-container:hover {
    border-color: rgba(0, 242, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.15);
}

.draggable-img-container.dragging {
    opacity: 0.7;
    border-color: var(--cyan-glow);
}

.image-handles {
    position: absolute;
    bottom: 5px;
    right: 5px;
    display: none;
}

.draggable-img-container:hover .image-handles {
    display: block;
}

.resize-handle {
    width: 20px;
    height: 20px;
    background: var(--cyan-glow);
    border-radius: 2px;
    cursor: nwse-resize;
    border: 1px solid #000;
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 1024px) {
    .home-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .editor-settings-grid {
        grid-template-columns: 1fr;
    }
    
    .post-page-container {
        padding: 0 20px;
    }
    
    .midnight-mode-btn {
        top: 80px;
        right: 20px;
    }
}

@media (max-width: 768px) {
    .signal-card {
        flex-direction: column;
    }
    
    .signal-thumb-container {
        width: 100%;
        height: 200px;
    }
    
    .container {
        padding: 0 20px;
    }
    
    .post-title {
        font-size: 1.8rem;
    }
    
    .post-meta {
        font-size: 0.75rem;
        gap: 10px;
    }
    
    .topic-filter-buttons {
        justify-content: space-between;
    }
    
    .topic-btn {
        flex: 1;
        text-align: center;
    }
}

/* =========================================
   EDIT LINK STYLING
   ========================================= */
.edit-link {
    color: #ffa500 !important;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
    padding: 2px 8px;
    border-radius: 4px;
}

.edit-link:hover {
    border-color: #ffa500;
    background: rgba(255, 165, 0, 0.1);
}

/* =========================================
   FULLSCREEN FIXES
   ========================================= */
:-webkit-full-screen {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
}

:-moz-full-screen {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
}

:fullscreen {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
}

.editor-wrapper-improved:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    overflow: auto;
    border-radius: 0;
}

.editor-wrapper-improved:fullscreen .ql-container {
    height: calc(100vh - 80px) !important;
}

/* =========================================
   CODE BLOCK STYLING
   ========================================= */
.ql-editor .ql-code-block {
    background: rgba(0, 242, 255, 0.08) !important;
    color: #00f2ff;
    border-left: 2px solid #00f2ff;
    padding: 12px;
    margin: 8px 0;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

.ql-snow .ql-formats {
    margin-bottom: 12px;
}

.ql-toolbar.ql-snow {
    border-color: rgba(0, 242, 255, 0.3);
}

.ql-container.ql-snow {
    border-color: rgba(0, 242, 255, 0.3);
}

/* =========================================
   IMAGE POSITIONING CONTROLS
   ========================================= */
.image-position-menu {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.2);
    border-radius: 6px;
}

.image-position-menu button {
    padding: 0.4rem 0.8rem;
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid rgba(0, 242, 255, 0.3);
    color: #00f2ff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.5;
    transition: all 0.2s;
}

.image-position-menu button:hover {
    background: rgba(0, 242, 255, 0.2);
    border-color: #00f2ff;
    opacity: 0.8;
}

.image-position-menu button[data-position="none"] {
    opacity: 1;
}

/* Image float styles in editor - match post-content exactly */
.ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    margin: 1.25rem 0;
}

.ql-editor img.float-left {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
    max-width: 45% !important;
    margin-top: 0 !important;
}

.ql-editor img.float-right {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    max-width: 45% !important;
    margin-top: 0 !important;
}

.ql-editor img.float-center {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    float: none !important;
}

@media (max-width: 768px) {
    .ql-editor img.float-left,
    .ql-editor img.float-right {
        float: none !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* =========================================
   PREMIUM PAGE
   ========================================= */
.premium-page {
    padding: 60px 0;
    max-width: 1000px;
    margin: 0 auto;
}

.premium-hero {
    text-align: center;
    margin-bottom: 30px;
}

.premium-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .premium-grid {
        grid-template-columns: 1fr;
    }
}

.perks-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
}

.perks-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-main);
}

.perks-list li:last-child {
    border-bottom: none;
}

.premium-price {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.premium-fineprint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 14px;
    text-align: center;
}

.premium-badge {
    color: var(--cyan-glow);
    font-weight: 800;
}

/* =========================================
   AD SLOTS (hidden for premium users server-side)
   ========================================= */
.ad-slot {
    background: var(--bg-card);
    border: 1px dashed var(--border-soft);
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    margin-top: 25px;
    color: var(--text-muted);
}

.ad-slot-label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.ad-slot-cta a {
    color: var(--cyan-glow);
}

.ad-slot-inline {
    margin: 30px 0;
}

/* =========================================
   PAYWALL TEASER
   ========================================= */
.post-content-teaser p {
    color: var(--text-main);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.paywall {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin-top: -10px;
}

.paywall p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.paywall .btn-cyan {
    display: inline-block;
    width: auto;
    padding: 14px 32px;
}

.form-group-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    text-transform: none;
    letter-spacing: normal;
}

.form-group-checkbox input[type="checkbox"] {
    width: auto;
}