/* ========================================
   ERRORDESK BLOG — Stylesheet
   Matches the Errordesk brand system
   ======================================== */

/* ---------- CSS Variables ---------- */
:root {
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-200: #bfdbfe;
    --brand-300: #93c5fd;
    --brand-400: #60a5fa;
    --brand-500: #3b82f6;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;
    --brand-800: #1e40af;
    --brand-900: #1e3a5f;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--slate-800);
    background: var(--slate-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

::selection { background: rgba(59, 130, 246, 0.15); color: var(--slate-900); }

a { color: var(--brand-600); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--brand-700); }
img { max-width: 100%; height: auto; }

/* ---------- Navbar ---------- */
.blog-navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    padding: 20px 0; transition: var(--transition); background: transparent;
}
.blog-navbar.scrolled {
    padding: 12px 0;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-shadow: var(--shadow-sm);
}
.blog-navbar-inner {
    max-width: 1140px; margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.blog-logo { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; color: var(--slate-900); text-decoration: none; z-index: 1001; }
.blog-logo span { color: var(--brand-600); }
.blog-logo:hover { color: var(--slate-900); }

.blog-nav-links { display: none; list-style: none; gap: 36px; align-items: center; }
.blog-nav-link { font-size: 0.85rem; font-weight: 500; color: var(--slate-500); text-decoration: none; position: relative; transition: color 0.2s; }
.blog-nav-link:hover { color: var(--slate-900); }
.blog-nav-link::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 1.5px; background: var(--slate-800); border-radius: 2px; transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.blog-nav-link:hover::after { width: 100%; }
.blog-nav-link.active { color: var(--brand-600); font-weight: 600; }
.blog-nav-link.active::after { width: 100%; background: var(--brand-600); }

.blog-nav-cta { display: none; font-size: 0.82rem; font-weight: 600; padding: 10px 20px; background: var(--slate-900); color: #fff; border-radius: var(--radius-sm); text-decoration: none; transition: var(--transition); }
.blog-nav-cta:hover { background: var(--brand-600); color: #fff; }

.blog-nav-toggle { display: flex; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; z-index: 1001; }
.blog-nav-toggle span { display: block; width: 24px; height: 1.5px; background: var(--slate-800); border-radius: 2px; transition: var(--transition); }
.blog-nav-toggle span:last-child { width: 16px; margin-left: auto; }
.blog-nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.blog-nav-toggle.open span:nth-child(2) { opacity: 0; }
.blog-nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); width: 24px; }

@media (min-width: 768px) {
    .blog-nav-links { display: flex; }
    .blog-nav-cta { display: inline-flex; }
    .blog-nav-toggle { display: none; }
}
@media (max-width: 767px) {
    .blog-nav-links.open {
        display: flex !important; flex-direction: column; position: fixed; inset: 0;
        background: rgba(255,255,255,0.98); backdrop-filter: blur(24px);
        justify-content: center; align-items: center; gap: 28px; z-index: 1000;
    }
    .blog-nav-links.open a { font-size: 1.4rem; font-weight: 600; color: var(--slate-900); }
}

/* ---------- Blog Hero / Page Header ---------- */
.blog-hero {
    padding-top: 120px; padding-bottom: 48px;
    background: linear-gradient(180deg, rgba(59,130,246,0.04) 0%, transparent 100%);
    text-align: center;
}
.blog-hero-inner { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.blog-hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 16px; border-radius: 100px;
    font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--brand-600); background: var(--brand-50); border: 1px solid var(--brand-100);
    margin-bottom: 20px;
}
.blog-hero-badge .pulse { width: 6px; height: 6px; background: var(--brand-500); border-radius: 50%; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.blog-hero h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 800;
    color: var(--slate-900); letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 12px;
}
.blog-hero p { font-size: 1.05rem; color: var(--slate-500); max-width: 520px; margin: 0 auto; font-weight: 300; line-height: 1.7; }
.blog-hero .gradient-text {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 40%, #1d4ed8 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ---------- Main Content ---------- */
.blog-main { flex: 1; padding: 0 24px 60px; }
.blog-container { max-width: 1140px; margin: 0 auto; }
.blog-container-narrow { max-width: 800px; margin: 0 auto; }

/* ---------- Post Grid ---------- */
.blog-grid {
    display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 40px;
}
@media (min-width: 640px) { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .blog-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Post Card ---------- */
.blog-card {
    background: #fff; border: 1px solid var(--slate-100); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--transition);
    display: flex; flex-direction: column;
}
.blog-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }

.blog-card-image {
    width: 100%; height: 200px; object-fit: cover;
    background: linear-gradient(135deg, var(--brand-50) 0%, var(--slate-100) 100%);
    display: flex; align-items: center; justify-content: center;
}
.blog-card-image-placeholder {
    width: 100%; height: 200px;
    background: linear-gradient(135deg, var(--brand-50) 0%, var(--slate-100) 100%);
    display: flex; align-items: center; justify-content: center; font-size: 2.5rem;
}
.blog-card-body { padding: 24px; flex: 1; display: flex; flex-direction: column; }
.blog-card-meta { font-size: 0.75rem; font-weight: 600; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; }
.blog-card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--slate-300); }

.blog-card-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.2rem; font-weight: 700; color: var(--slate-900);
    line-height: 1.35; margin-bottom: 10px; letter-spacing: -0.01em;
    transition: color 0.2s;
}
.blog-card:hover .blog-card-title { color: var(--brand-600); }

.blog-card-excerpt { font-size: 0.88rem; color: var(--slate-500); line-height: 1.7; flex: 1; margin-bottom: 16px; font-weight: 300; }

.blog-card-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.82rem; font-weight: 600; color: var(--brand-600);
    text-decoration: none; transition: var(--transition);
}
.blog-card-link:hover { gap: 10px; }
.blog-card-link svg { transition: transform 0.2s; }
.blog-card-link:hover svg { transform: translateX(3px); }

/* ---------- Single Post ---------- */
.blog-single { padding-top: 120px; padding-bottom: 60px; }
.blog-single-inner { max-width: 800px; margin: 0 auto; padding: 0 24px; }

.blog-single-header { margin-bottom: 40px; text-align: center; }
.blog-single-meta { font-size: 0.8rem; font-weight: 600; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; display: flex; justify-content: center; gap: 16px; align-items: center; }
.blog-single-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--slate-300); }

.blog-single-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800;
    color: var(--slate-900); letter-spacing: -0.02em; line-height: 1.2;
}

.blog-single-content {
    font-size: 1.05rem; line-height: 1.85; color: var(--slate-700);
}
.blog-single-content p { margin-bottom: 1.5em; }
.blog-single-content h2 { font-family: 'Playfair Display', Georgia, serif; font-size: 1.6rem; font-weight: 700; color: var(--slate-900); margin: 2em 0 0.8em; }
.blog-single-content h3 { font-size: 1.2rem; font-weight: 700; color: var(--slate-800); margin: 1.5em 0 0.6em; }
.blog-single-content ul, .blog-single-content ol { padding-left: 24px; margin-bottom: 1.5em; }
.blog-single-content li { margin-bottom: 0.5em; }
.blog-single-content blockquote { border-left: 3px solid var(--brand-500); padding: 16px 24px; background: var(--brand-50); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.5em 0; font-style: italic; color: var(--slate-600); }
.blog-single-content code { background: var(--slate-100); padding: 2px 8px; border-radius: 4px; font-size: 0.9em; }
.blog-single-content pre { background: var(--slate-900); color: #e2e8f0; padding: 20px 24px; border-radius: var(--radius-md); overflow-x: auto; margin: 1.5em 0; font-size: 0.88rem; line-height: 1.6; }
.blog-single-content pre code { background: transparent; padding: 0; color: inherit; }
.blog-single-content img { border-radius: var(--radius-md); margin: 1.5em 0; }

.blog-back-link { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600; color: var(--slate-500); margin-bottom: 32px; text-decoration: none; }
.blog-back-link:hover { color: var(--brand-600); }
.blog-back-link svg { transition: transform 0.2s; }
.blog-back-link:hover svg { transform: translateX(-3px); }

/* ---------- Pagination ---------- */
.blog-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 48px; }
.blog-pagination a, .blog-pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    font-size: 0.88rem; font-weight: 600; transition: var(--transition);
    border: 1px solid var(--slate-200); color: var(--slate-600); text-decoration: none;
}
.blog-pagination a:hover { border-color: var(--brand-400); color: var(--brand-600); background: var(--brand-50); }
.blog-pagination .active { background: var(--slate-900); color: #fff; border-color: var(--slate-900); }

/* ---------- Empty State ---------- */
.blog-empty {
    text-align: center; padding: 80px 24px;
}
.blog-empty-icon { font-size: 4rem; margin-bottom: 20px; opacity: 0.5; }
.blog-empty h2 { font-size: 1.4rem; font-weight: 700; color: var(--slate-800); margin-bottom: 8px; }
.blog-empty p { font-size: 0.92rem; color: var(--slate-500); }

/* ---------- Admin Dashboard ---------- */
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 16px; margin-bottom: 32px; padding-top: 8px;
}
.admin-header h2 { font-size: 1.4rem; font-weight: 700; color: var(--slate-900); }
.admin-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 32px; }
.admin-stat-card {
    background: #fff; border: 1px solid var(--slate-100); border-radius: var(--radius-md);
    padding: 20px 24px; flex: 1; min-width: 140px; text-align: center;
    box-shadow: var(--shadow-sm);
}
.admin-stat-card .number { font-size: 2rem; font-weight: 800; color: var(--slate-900); line-height: 1.2; }
.admin-stat-card .label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--slate-400); margin-top: 4px; }

/* ---------- Admin Table ---------- */
.admin-table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--slate-100); background: #fff; box-shadow: var(--shadow-sm); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th { padding: 14px 18px; text-align: left; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate-500); background: var(--slate-50); border-bottom: 1px solid var(--slate-100); white-space: nowrap; }
.admin-table td { padding: 16px 18px; border-bottom: 1px solid var(--slate-50); color: var(--slate-700); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--brand-50); }

.admin-table .post-title-cell { font-weight: 600; color: var(--slate-900); max-width: 300px; }

/* ---------- Status Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 100px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.badge-published { background: #dcfce7; color: #166534; }
.badge-draft { background: #fef3c7; color: #92400e; }

/* ---------- Action Links ---------- */
.action-links { display: flex; gap: 10px; align-items: center; }
.action-link { font-size: 0.82rem; font-weight: 600; text-decoration: none; padding: 6px 14px; border-radius: var(--radius-sm); transition: var(--transition); white-space: nowrap; }
.action-link-edit { color: var(--brand-600); background: var(--brand-50); }
.action-link-edit:hover { background: var(--brand-100); color: var(--brand-700); }
.action-link-delete { color: #dc2626; background: #fef2f2; }
.action-link-delete:hover { background: #fee2e2; color: #991b1b; }

/* ---------- Buttons ---------- */
.blog-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; font-size: 0.88rem; font-weight: 600;
    font-family: 'Inter', system-ui, sans-serif; border: none; border-radius: var(--radius-sm);
    cursor: pointer; transition: var(--transition); text-decoration: none; line-height: 1;
}
.blog-btn-primary { background: var(--slate-900); color: #fff; }
.blog-btn-primary:hover { background: var(--brand-600); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.blog-btn-brand { background: var(--brand-600); color: #fff; }
.blog-btn-brand:hover { background: var(--brand-700); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,99,235,0.3); }
.blog-btn-secondary { background: #fff; color: var(--slate-700); border: 1px solid var(--slate-200); }
.blog-btn-secondary:hover { border-color: var(--slate-300); color: var(--slate-900); transform: translateY(-1px); }
.blog-btn-danger { background: #ef4444; color: #fff; }
.blog-btn-danger:hover { background: #dc2626; color: #fff; }
.blog-btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.blog-btn-lg { padding: 16px 32px; font-size: 0.95rem; }

/* ---------- Form Elements ---------- */
.blog-form-group { margin-bottom: 24px; }
.blog-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--slate-700); margin-bottom: 8px; letter-spacing: 0.01em; }
.blog-input, .blog-textarea, .blog-select {
    width: 100%; padding: 12px 16px; font-size: 0.92rem;
    font-family: 'Inter', system-ui, sans-serif; color: var(--slate-800);
    background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-sm);
    outline: none; transition: var(--transition);
}
.blog-input:focus, .blog-textarea:focus, .blog-select:focus {
    border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.blog-input::placeholder, .blog-textarea::placeholder { color: var(--slate-400); }
.blog-textarea { resize: vertical; min-height: 300px; line-height: 1.7; }
.blog-select {
    appearance: none; cursor: pointer; padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.blog-form-hint { font-size: 0.78rem; color: var(--slate-400); margin-top: 6px; }
.blog-form-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .blog-form-row { grid-template-columns: 1fr 1fr; } }

/* ---------- Admin Login ---------- */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--slate-50); }
.login-card {
    background: #fff; border: 1px solid var(--slate-100); border-radius: var(--radius-xl);
    padding: 48px 40px; max-width: 420px; width: 100%; box-shadow: var(--shadow-md);
    text-align: center;
}
.login-card .blog-logo { font-size: 1.6rem; display: block; margin-bottom: 8px; }
.login-card h1 { font-size: 1.3rem; font-weight: 700; color: var(--slate-900); margin-bottom: 4px; }
.login-card .subtitle { font-size: 0.88rem; color: var(--slate-500); margin-bottom: 32px; font-weight: 300; }
.login-card .blog-form-group { text-align: left; }
.login-card .blog-btn { width: 100%; justify-content: center; padding: 14px; margin-top: 8px; }

.login-error {
    background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
    padding: 10px 16px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500;
    margin-bottom: 20px;
}

/* ---------- Alert Messages ---------- */
.blog-alert {
    padding: 12px 20px; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 500;
    margin-bottom: 20px; display: flex; align-items: center; gap: 10px;
}
.blog-alert-success { background: #dcfce7; border: 1px solid #bbf7d0; color: #166534; }
.blog-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ---------- Card (editor) ---------- */
.blog-editor-card {
    background: #fff; border: 1px solid var(--slate-100); border-radius: var(--radius-lg);
    padding: 40px; box-shadow: var(--shadow-sm);
}

/* ---------- Footer ---------- */
.blog-footer { border-top: 1px solid var(--slate-100); padding: 60px 0 32px; background: #fff; margin-top: auto; }
.blog-footer-inner { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.blog-footer-grid { display: grid; grid-template-columns: 1fr; gap: 40px; margin-bottom: 40px; }
@media (min-width: 768px) { .blog-footer-grid { grid-template-columns: 1fr 2fr; gap: 64px; } }
.blog-footer-brand p { font-size: 0.88rem; color: var(--slate-400); margin-top: 12px; max-width: 260px; line-height: 1.6; }
.blog-footer-links-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
@media (max-width: 640px) { .blog-footer-links-grid { grid-template-columns: repeat(2, 1fr); } }
.blog-footer-links-grid h4 { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; color: var(--slate-400); margin-bottom: 16px; }
.blog-footer-links-grid a { display: block; font-size: 0.88rem; color: var(--slate-500); padding: 6px 0; text-decoration: none; transition: color 0.2s; }
.blog-footer-links-grid a:hover { color: var(--brand-600); }
.blog-footer-bottom {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    padding-top: 32px; border-top: 1px solid var(--slate-100); gap: 8px;
}
.blog-footer-bottom p { font-size: 0.78rem; color: var(--slate-400); }
.blog-footer-tagline { font-style: italic; }

/* ---------- Reveal Animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1), transform 0.7s cubic-bezier(0.16,1,0.3,1); }
.reveal.revealed { opacity: 1; transform: translateY(0); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--slate-50); }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }
