/**
 * PugWorks Blog Styles
 * Matches the main site design system
 */

:root {
    --primary: #2B4A7C;
    --primary-light: #3d6299;
    --primary-dark: #1e3557;
    --secondary: #D4A574;
    --secondary-light: #e4c4a4;
    --accent: #5B8C5A;
    --accent-light: #7aa879;
    --dark: #1A1A1A;
    --light: #F5F0EB;
    --gray: #6B7280;
    --white: #FFFFFF;
    --error: #dc2626;
    --success: #16a34a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--dark);
    background: var(--light);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navigation - Same as main site */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(43, 74, 124, 0.08);
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    width: 48px;
    height: 48px;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary);
}

.logo-text span {
    color: var(--secondary);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-cta {
    background: var(--primary);
    color: var(--white) !important;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
}

.nav-cta:hover {
    background: var(--primary-light) !important;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary);
    margin: 5px 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--gray);
    border: 1px solid var(--gray);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Blog Header */
.blog-header {
    padding: 8rem 0 4rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    text-align: center;
}

.blog-header h1 {
    font-size: 3rem;
    color: var(--white);
    margin-bottom: 1rem;
}

.blog-header p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Blog Content */
.blog-content {
    padding: 4rem 0;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

@media (max-width: 968px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Post Card */
.post-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 4px 20px rgba(43, 74, 124, 0.08);
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(43, 74, 124, 0.15);
}

.post-card-image {
    height: 200px;
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

.post-card-content {
    padding: 1.5rem;
}

.post-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--gray);
}

.post-card-title {
    font-size: 1.25rem;
    color: var(--dark);
    margin-bottom: 0.75rem;
}

.post-card-excerpt {
    color: var(--gray);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.post-card.small {
    display: flex;
    flex-direction: column;
}

.post-card.small .post-card-title {
    font-size: 1rem;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No Posts */
.no-posts {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

.no-posts svg {
    margin-bottom: 1rem;
    stroke: var(--gray);
}

.no-posts h3 {
    margin-bottom: 0.5rem;
    color: var(--dark);
}

/* Error State */
.error-state {
    text-align: center;
    padding: 4rem 2rem;
}

.error-state svg {
    margin-bottom: 1rem;
    stroke: var(--gray);
}

/* Single Post */
.blog-post {
    padding: 8rem 0 4rem;
    background: var(--white);
}

.post-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

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

.post-meta {
    display: flex;
    gap: 1rem;
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-header h1 {
    font-size: 2.5rem;
    color: var(--dark);
    margin-bottom: 1rem;
}

.post-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background: var(--light);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.post-featured-image {
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
}

.post-featured-image img {
    width: 100%;
    height: auto;
}

.post-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--dark);
}

.post-body h2 {
    font-size: 1.75rem;
    margin: 2rem 0 1rem;
}

.post-body h3 {
    font-size: 1.5rem;
    margin: 1.5rem 0 0.75rem;
}

.post-body p {
    margin-bottom: 1.5rem;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.post-body blockquote {
    border-left: 4px solid var(--secondary);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--gray);
}

.post-body pre {
    background: var(--dark);
    color: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-body code {
    background: var(--light);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Source Code Pro', monospace;
}

.post-body pre code {
    background: none;
    padding: 0;
}

.post-body a {
    color: var(--primary);
}

.post-body ul, .post-body ol {
    margin: 1rem 0 1.5rem 2rem;
}

.post-body li {
    margin-bottom: 0.5rem;
}

/* Tables in post body and editor */
.post-body table,
.ql-editor table,
.blog-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.post-body table th,
.post-body table td,
.ql-editor table th,
.ql-editor table td,
.blog-table th,
.blog-table td {
    border: 1px solid #d1d5db;
    padding: 0.75rem 1rem;
    text-align: left;
    vertical-align: top;
}

.post-body table th,
.ql-editor table th,
.blog-table th {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.post-body table tr:nth-child(even),
.ql-editor table tr:nth-child(even),
.blog-table tr:nth-child(even) {
    background: #f9fafb;
}

.post-body table tr:hover,
.ql-editor table tr:hover,
.blog-table tr:hover {
    background: #f3f4f6;
}

/* Quill Better Table styles */
.quill-better-table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.quill-better-table {
    width: 100%;
    border-collapse: collapse;
}

.quill-better-table td {
    border: 1px solid #d1d5db;
    padding: 0.75rem 1rem;
    min-width: 80px;
}

.quill-better-table td[data-row="0"] {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.qlbt-operation-menu {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    z-index: 1000;
}

.qlbt-operation-menu .qlbt-operation-menu-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.qlbt-operation-menu .qlbt-operation-menu-item:hover {
    background: var(--light);
}

.qlbt-col-tool,
.qlbt-row-tool {
    background: var(--primary-light);
    opacity: 0.7;
}

.qlbt-col-tool:hover,
.qlbt-row-tool:hover {
    opacity: 1;
}

/* Author */
.post-author {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 2rem 0;
    border-top: 1px solid var(--light);
    border-bottom: 1px solid var(--light);
    margin: 2rem 0;
}

.author-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-weight: 600;
    color: var(--dark);
    display: block;
}

.author-bio {
    color: var(--gray);
    font-size: 0.9rem;
}

/* Share */
.post-share {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.post-share span {
    color: var(--gray);
}

.share-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray);
    border-radius: 20px;
    background: var(--white);
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Comments Section */
.comments-section {
    padding: 4rem 0;
    background: var(--light);
}

.comments-section h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.comment-count {
    color: var(--gray);
    font-weight: normal;
}

.comments-list {
    margin-bottom: 3rem;
}

.comment {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.comment-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.comment-author {
    font-weight: 600;
    color: var(--dark);
}

.comment-date {
    color: var(--gray);
    font-size: 0.85rem;
}

.comment-body {
    color: var(--dark);
}

.no-comments {
    color: var(--gray);
    text-align: center;
    padding: 2rem;
}

/* Comment Form */
.comment-form-wrapper {
    background: var(--white);
    padding: 2rem;
    border-radius: 16px;
}

.comment-form-wrapper h3 {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.form-group .required {
    color: var(--error);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.form-group small {
    color: var(--gray);
    font-size: 0.8rem;
}

.form-message {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: none;
}

.form-message.success {
    display: block;
    background: #dcfce7;
    color: #166534;
}

.form-message.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
}

/* Related Posts */
.related-posts {
    padding: 4rem 0;
    background: var(--white);
}

.related-posts h2 {
    margin-bottom: 2rem;
}

/* Footer */
footer {
    background: var(--dark);
    padding: 4rem 2rem 2rem;
    color: var(--white);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.6);
    margin-top: 1rem;
}

.footer-links h4 {
    color: var(--secondary);
    margin-bottom: 1rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
}

/* Admin Dashboard */
.admin-body {
    background: var(--white);
}

.admin-dashboard {
    padding: 6rem 0 4rem;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-header h1 {
    font-size: 2rem;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--light);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.stat-number {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    color: var(--gray);
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--light);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    color: var(--gray);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--primary);
    background: var(--light);
}

.posts-table {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.posts-table table {
    width: 100%;
    border-collapse: collapse;
}

.posts-table th,
.posts-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--light);
}

.posts-table th {
    background: var(--light);
    font-weight: 600;
    color: var(--gray);
}

.post-title-link {
    color: var(--dark);
    text-decoration: none;
    font-weight: 600;
}

.post-title-link:hover {
    color: var(--primary);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.published {
    background: #dcfce7;
    color: #166534;
}

.status-badge.draft {
    background: #fef3c7;
    color: #92400e;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: var(--light);
    color: var(--gray);
}

.action-btn:hover {
    background: var(--primary);
    color: var(--white);
}

.action-btn.delete:hover {
    background: var(--error);
}

/* Editor */
.editor-body {
    background: var(--white);
}

.editor-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

/* Editor with Sidebar Layout */
.editor-main {
    display: flex;
    padding-top: 4rem;
    min-height: 100vh;
}

.editor-sidebar {
    position: fixed;
    top: 4rem;
    left: 0;
    width: 180px;
    height: calc(100vh - 4rem);
    background: #f8f9fa;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-toolbar {
    padding: 1rem;
}

.toolbar-section {
    margin-bottom: 1.25rem;
}

.toolbar-section > label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.toolbar-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: var(--white);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    color: var(--dark);
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.toolbar-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.toolbar-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.toolbar-btn svg {
    width: 16px;
    height: 16px;
}

/* Font selector */
.font-selector {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--white);
    cursor: pointer;
}

.font-selector:focus {
    outline: none;
    border-color: var(--primary);
}

/* Font size selector */
.size-selector {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--white);
    cursor: pointer;
}

/* Editor Content Area */
.editor-content {
    flex: 1;
    margin-left: 180px;
    padding: 1rem 0;
}

.editor-header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray);
    text-decoration: none;
}

.back-link:hover {
    color: var(--primary);
}

.editor-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.draft {
    background: #f59e0b;
}

.status-dot.published {
    background: #10b981;
}

.editor-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.save-indicator {
    color: var(--gray);
    font-size: 0.85rem;
}

.editor-container {
    width: 70%;
    max-width: none;
    margin: 0 auto;
    padding: 0 2rem;
}

.post-title-input {
    width: 100%;
    font-size: 2.5rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    border: none;
    outline: none;
    margin-bottom: 1rem;
    color: var(--dark);
}

.post-title-input::placeholder {
    color: #d1d5db;
}

.slug-row {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    color: var(--gray);
    font-size: 0.9rem;
}

.slug-prefix {
    color: var(--gray);
}

.slug-input {
    border: none;
    outline: none;
    font-size: 0.9rem;
    color: var(--primary);
    flex: 1;
}

.featured-image-section {
    margin-bottom: 2rem;
}

.featured-image-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.featured-image-preview {
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.featured-image-preview:hover {
    border-color: var(--primary);
}

.featured-image-preview .placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray);
}

.featured-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    background: var(--error);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

.featured-image-section input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9rem;
}

.tags-section {
    margin-bottom: 2rem;
}

.tags-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.tags-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tags-list .tag {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tags-list .tag button {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}

#tagInput {
    border: none;
    outline: none;
    flex: 1;
    min-width: 100px;
    padding: 0.25rem;
}

.editor-wrapper {
    margin-bottom: 2rem;
}

#editor {
    min-height: 400px;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Hide default Quill toolbar when using sidebar */
.ql-toolbar {
    display: none;
}

.ql-container {
    border-radius: 8px;
    border-color: #e5e7eb;
    font-size: 1.1rem;
}

.ql-container.ql-snow {
    border: 1px solid #e5e7eb;
}

.ql-editor {
    min-height: 400px;
    padding: 1.5rem;
}

/* Font styles in editor */
.ql-font-Open-Sans { font-family: 'Open Sans', sans-serif; }
.ql-font-Roboto { font-family: 'Roboto', sans-serif; }
.ql-font-Lato { font-family: 'Lato', sans-serif; }
.ql-font-Montserrat { font-family: 'Montserrat', sans-serif; }
.ql-font-Poppins { font-family: 'Poppins', sans-serif; }
.ql-font-Raleway { font-family: 'Raleway', sans-serif; }
.ql-font-Nunito { font-family: 'Nunito', sans-serif; }
.ql-font-Source-Sans-3 { font-family: 'Source Sans 3', sans-serif; }
.ql-font-PT-Sans { font-family: 'PT Sans', sans-serif; }
.ql-font-Ubuntu { font-family: 'Ubuntu', sans-serif; }
.ql-font-Oswald { font-family: 'Oswald', sans-serif; }
.ql-font-Quicksand { font-family: 'Quicksand', sans-serif; }
.ql-font-Work-Sans { font-family: 'Work Sans', sans-serif; }
.ql-font-Josefin-Sans { font-family: 'Josefin Sans', sans-serif; }
.ql-font-Rubik { font-family: 'Rubik', sans-serif; }
.ql-font-Inter { font-family: 'Inter', sans-serif; }
.ql-font-Karla { font-family: 'Karla', sans-serif; }
.ql-font-Mulish { font-family: 'Mulish', sans-serif; }
.ql-font-Cabin { font-family: 'Cabin', sans-serif; }
.ql-font-Barlow { font-family: 'Barlow', sans-serif; }
.ql-font-Fira-Sans { font-family: 'Fira Sans', sans-serif; }
.ql-font-Arimo { font-family: 'Arimo', sans-serif; }
.ql-font-DM-Sans { font-family: 'DM Sans', sans-serif; }
.ql-font-Space-Grotesk { font-family: 'Space Grotesk', sans-serif; }
.ql-font-IBM-Plex-Sans { font-family: 'IBM Plex Sans', sans-serif; }
.ql-font-Archivo { font-family: 'Archivo', sans-serif; }
.ql-font-Manrope { font-family: 'Manrope', sans-serif; }
.ql-font-Outfit { font-family: 'Outfit', sans-serif; }
.ql-font-Plus-Jakarta-Sans { font-family: 'Plus Jakarta Sans', sans-serif; }
.ql-font-Sora { font-family: 'Sora', sans-serif; }
.ql-font-Be-Vietnam-Pro { font-family: 'Be Vietnam Pro', sans-serif; }
.ql-font-Lexend { font-family: 'Lexend', sans-serif; }
.ql-font-Playfair-Display { font-family: 'Playfair Display', serif; }
.ql-font-Merriweather { font-family: 'Merriweather', serif; }
.ql-font-Lora { font-family: 'Lora', serif; }
.ql-font-Roboto-Slab { font-family: 'Roboto Slab', serif; }
.ql-font-Bitter { font-family: 'Bitter', serif; }
.ql-font-Crimson-Text { font-family: 'Crimson Text', serif; }
.ql-font-EB-Garamond { font-family: 'EB Garamond', serif; }
.ql-font-Libre-Baskerville { font-family: 'Libre Baskerville', serif; }
.ql-font-Source-Serif-4 { font-family: 'Source Serif 4', serif; }
.ql-font-Cormorant-Garamond { font-family: 'Cormorant Garamond', serif; }

/* Table editing in Quill editor */
.ql-editor table {
    table-layout: fixed;
}

.ql-editor td {
    position: relative;
}

.ql-editor td:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* Table selection highlight */
.ql-editor td.ql-cell-selected {
    background: rgba(43, 74, 124, 0.1) !important;
}

/* Responsive tables */
@media (max-width: 768px) {
    .post-body table,
    .ql-editor table,
    .quill-better-table-wrapper {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.seo-section {
    background: var(--light);
    padding: 1.5rem;
    border-radius: 12px;
}

.seo-section summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--dark);
}

.seo-fields {
    margin-top: 1.5rem;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--light);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
}

.versions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.version-item {
    background: var(--light);
    padding: 1rem;
    border-radius: 8px;
}

.version-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.version-number {
    font-weight: 600;
}

.version-date {
    color: var(--gray);
    font-size: 0.85rem;
}

.version-preview {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .editor-sidebar {
        width: 160px;
    }

    .editor-content {
        margin-left: 160px;
    }
}

@media (max-width: 768px) {
    .blog-header h1 {
        font-size: 2rem;
    }

    .post-header h1 {
        font-size: 1.75rem;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .editor-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .post-title-input {
        font-size: 1.75rem;
    }

    /* Stack sidebar on mobile */
    .editor-main {
        flex-direction: column;
    }

    .editor-sidebar {
        position: relative;
        top: 0;
        width: 100%;
        height: auto;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .sidebar-toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        padding: 0.75rem;
    }

    .toolbar-section {
        margin-bottom: 0;
    }

    .toolbar-section > label {
        display: none;
    }

    .editor-content {
        margin-left: 0;
    }

    .editor-container {
        width: 100%;
        padding: 0 1rem;
    }
}
