/* Blog app shared styles */
:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2937;
    background: #f9fafb;
    line-height: 1.6;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
}
img {
    max-width: 100%;
    display: block;
}
a {
    color: #2563eb;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
button,
input,
textarea,
select {
    font: inherit;
}
button {
    cursor: pointer;
}
header,
footer {
    width: 100%;
    padding: 1rem 1.25rem;
}
header {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(148,163,184,.16);
    z-index: 50;
}
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
}
.nav-brand span {
    color: #4f46e5;
}
.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}
.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 0.8rem 1.2rem;
    background: #4f46e5;
    color: #fff;
    font-weight: 600;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.button.secondary,
button.secondary {
    background: #e0e7ff;
    color: #1f2937;
}
.button:hover,
button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(79,70,229,0.12);
}
main {
    width: 100%;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2rem;
}
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    color: white;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}
.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}
.hero h1 {
    margin: 0 0 1rem;
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    font-weight: 800;
}
.hero p {
    max-width: 600px;
    margin: 0 0 2rem;
    font-size: 1.2rem;
    opacity: 0.9;
    line-height: 1.6;
}
.hero-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}
.stat {
    text-align: center;
}
.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
}
.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}
.button.primary {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-weight: 600;
}
.button.primary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}
.button.ghost {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.button.ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(148,163,184,.1);
}
.section-header h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
}
.section-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 0.9rem;
}
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}
.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}
.empty-state h3 {
    margin: 0 0 0.5rem;
    color: #374151;
}
.empty-state p {
    margin: 0 0 1.5rem;
    color: #6b7280;
}
.share-button {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid rgba(148,163,184,.35) !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    border-radius: 6px !important;
}
.share-button:hover {
    background: #e2e8f0 !important;
    transform: none !important;
}
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}
.post-card,
.post-panel,
.auth-card {
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(148,163,184,.18);
    box-shadow: 0 18px 40px rgba(15,23,42,0.05);
    overflow: hidden;
}
.post-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.post-card-content,
.post-panel-content,
.auth-card-content {
    padding: 1.25rem;
}
.post-card-title,
.post-panel-title {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
}
.post-card-text,
.post-panel-text,
.auth-card p {
    color: #475569;
    margin: 0 0 1rem;
}
.metadata {
    font-size: 0.95rem;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.draft-badge {
    background: #f59e0b;
    color: white;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
}
.draft-notice {
    margin-top: 1rem;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid rgba(234, 179, 8, 0.35);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
}
.message {
    padding: 1.5rem;
    border-radius: 18px;
    border: 1px dashed rgba(100,116,139,0.35);
    background: rgba(255,255,255,0.9);
    color: #334155;
}
form {
    display: grid;
    gap: 1rem;
}
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea {
    width: 100%;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 14px;
    padding: 0.95rem 1rem;
    background: #f8fafc;
    color: #0f172a;
}
textarea {
    min-height: 220px;
    resize: vertical;
}
.content-editor {
    min-height: 220px;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 14px;
    padding: 0.95rem 1rem;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    resize: vertical;
    overflow-y: auto;
}
.content-editor:empty::before {
    content: attr(placeholder);
    color: #64748b;
    pointer-events: none;
}

label {
    font-weight: 600;
    color: #0f172a;
}
.field-row {
    display: grid;
    gap: 1rem;
}
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}
footer {
    background: transparent;
    text-align: center;
    color: #475569;
    font-size: 0.95rem;
}
footer a {
    color: #4f46e5;
}
.hidden {
    display: none !important;
}
.admin-only {
    display: none;
}
.message-note {
    margin-top: 0.5rem;
    color: #334155;
}
.toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    background: rgba(15,23,42,0.96);
    color: #fff;
    padding: 1rem 1.2rem;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(15,23,42,0.2);
    z-index: 100;
    opacity: 0.98;
}
@media (max-width: 720px) {
    main {
        padding: 1rem;
    }
    header,
    footer {
        padding: 1rem;
    }
    .hero {
        padding: 2rem 1.5rem;
        margin-bottom: 1.5rem;
    }
    .hero h1 {
        font-size: 2.5rem;
    }
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    .hero-actions {
        justify-content: center;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .section-actions {
        width: 100%;
        justify-content: space-between;
    }
    .formatting-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }
    .toolbar-group {
        justify-content: center;
        flex-wrap: wrap;
    }
    .post-card-content .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    .share-button {
        width: 100%;
    }
}


/* Formatting toolbar */
.formatting-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 12px;
}
.toolbar-group {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}
.formatting-toolbar button {
    padding: 0.5rem 0.75rem;
    background: #e0e7ff;
    color: #1f2937;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 2rem;
    transition: all 0.2s ease;
}
.formatting-toolbar button:hover {
    background: #c7d2fe;
    transform: translateY(-1px);
}
.formatting-toolbar button:active {
    background: #a5b4fc;
}
.formatting-toolbar select {
    padding: 0.5rem;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 6px;
    background: white;
    color: #0f172a;
    font-size: 0.85rem;
    min-width: 80px;
}
.formatting-toolbar input[type="color"] {
    width: 40px;
    height: 32px;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 6px;
    cursor: pointer;
}

/* Loading animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e7ff;
    border-radius: 50%;
    border-top-color: #4f46e5;
    animation: spin 1s ease-in-out infinite;
    margin-right: 0.5rem;
}

.post-card {
    animation: fadeIn 0.5s ease-out;
}

.message {
    animation: fadeIn 0.3s ease-out;
}

/* Reactions and Comments */
.comment-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(148,163,184,.18);
}

.reactions-panel {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.reactions-title {
    font-weight: 600;
    color: #334155;
    margin: 0 0 1rem;
    font-size: 0.95rem;
}

.reaction-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem;
    background: white;
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 999px;
    color: #475569;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reaction-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.reaction-btn.active {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: #4f46e5;
    font-weight: 600;
}

.reaction-emoji {
    font-size: 1rem;
}

.reaction-count {
    min-width: 1.5rem;
    text-align: center;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment-item {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 3px solid #e0e7ff;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.95rem;
}

.comment-date {
    font-size: 0.8rem;
    color: #94a3b8;
}

.comment-text {
    color: #334155;
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.reply-btn {
    padding: 0.3rem 0.6rem;
    background: #e0e7ff;
    border: 1px solid #a5b4fc;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #4f46e5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reply-btn:hover {
    background: #c7d2fe;
    border-color: #8b5cf6;
}

.reply-form {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
}

.reply-form textarea {
    width: 100%;
    min-height: 60px;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
}

.replies-list {
    margin-top: 1rem;
    margin-left: 1.5rem;
    border-left: 2px solid #e0e7ff;
    padding-left: 1rem;
}

.reply-item {
    padding: 0.75rem;
    background: #ffffff;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 2px solid #a5b4fc;
}

.delete-btn {
    padding: 0.2rem 0.5rem;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: #fecaca;
    border-color: #f87171;
}

.comment-reaction-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    background: white;
    border: 1px solid rgba(148,163,184,.25);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-reaction-btn:hover {
    background: white;
    border-color: #cbd5e1;
}

.comment-reaction-btn.active {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #b45309;
}

.comment-form {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid rgba(148,163,184,.18);
}

.comment-form label {
    margin-bottom: 0.5rem;
}

.comment-form textarea {
    min-height: 100px;
    margin-bottom: 0.75rem;
}

.comment-form .metadata {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: #64748b;
}

/* Better button states */
.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.1);
}

/* Improved focus states */
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Better content editor */
.content-editor:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}


