/* =========================================
   MiniCMS — Ana Site Stilleri
   ========================================= */

:root {
    --c-primary:   #1a2744;
    --c-accent:    #2d5fa6;
    --c-accent-lt: #e8f0fb;
    --c-text:      #1f2937;
    --c-muted:     #6b7280;
    --c-border:    #e5e7eb;
    --c-bg:        #f9fafb;
    --c-white:     #ffffff;
    --c-success:   #166534;
    --c-error:     #991b1b;
    --radius:      8px;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
    --shadow-md:   0 4px 16px rgba(0,0,0,.1);
    --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
    --header-h:    70px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.7;
    font-size: 16px;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { color: var(--c-primary); }

img { max-width: 100%; height: auto; }

/* Container */
.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.py-60 { padding-top: 60px; padding-bottom: 60px; }

/* =========================================
   HEADER
   ========================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--c-primary);
    height: var(--header-h);
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 1.3rem;
    text-decoration: none;
}

.site-logo img { height: 40px; width: auto; }
.logo-text { color: #fff; font-size: 1.3rem; font-weight: 700; }

.site-nav { display: flex; align-items: center; }

.nav-list {
    display: flex;
    list-style: none;
    gap: 4px;
}

.nav-list a {
    display: block;
    padding: 8px 14px;
    color: rgba(255,255,255,.85);
    font-size: .9rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: background .2s, color .2s;
}

.nav-list a:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .3s;
}

/* =========================================
   CONTENT LAYOUT
   ========================================= */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
}

.single-col { max-width: 820px; margin: 0 auto; }

.main-col {}
.sidebar-col {}

/* =========================================
   HOME — POST LIST
   ========================================= */
.page-header-section { margin-bottom: 36px; }
.section-title { font-size: 1.8rem; font-weight: 700; color: var(--c-primary); }
.section-subtitle { color: var(--c-muted); margin-top: 8px; font-size: 1rem; }

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

.post-card {
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 28px;
    transition: box-shadow .2s, transform .2s;
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-date {
    font-size: .8rem;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    display: block;
    margin-bottom: 8px;
}

.post-card-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; }
.post-card-title a { color: var(--c-primary); }
.post-card-title a:hover { color: var(--c-accent); }
.post-card-excerpt { color: var(--c-muted); font-size: .95rem; margin-bottom: 14px; }
.read-more { font-size: .9rem; font-weight: 600; color: var(--c-accent); }
.read-more:hover { color: var(--c-primary); }

/* =========================================
   SINGLE POST
   ========================================= */
.single-post {}

.post-header { margin-bottom: 30px; border-bottom: 2px solid var(--c-border); padding-bottom: 20px; }
.post-title { font-size: 2rem; font-weight: 800; color: var(--c-primary); line-height: 1.3; }
.post-meta { margin-top: 10px; color: var(--c-muted); font-size: .9rem; }

.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--c-text);
}

.post-content h1,.post-content h2,.post-content h3,
.post-content h4,.post-content h5,.post-content h6 {
    margin: 1.6em 0 .6em;
    color: var(--c-primary);
    line-height: 1.3;
}

.post-content p { margin-bottom: 1.2em; }
.post-content ul,.post-content ol { margin: 1em 0 1em 1.6em; }
.post-content li { margin-bottom: .4em; }
.post-content blockquote {
    border-left: 4px solid var(--c-accent);
    padding: 14px 20px;
    background: var(--c-accent-lt);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1.2em 0;
    font-style: italic;
}
.post-content img {
    border-radius: var(--radius);
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.2em auto;
}
.post-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}
.post-content th,.post-content td {
    border: 1px solid var(--c-border);
    padding: 10px 14px;
}
.post-content th { background: var(--c-primary); color: #fff; }
.post-content a { color: var(--c-accent); text-decoration: underline; }
.post-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: .9em;
}
.post-content pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.2em 0;
}

/* Post Navigation */
.post-navigation {
    display: flex;
    gap: 16px;
    margin: 40px 0;
    border-top: 1px solid var(--c-border);
    padding-top: 24px;
}

.nav-prev, .nav-next {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px 20px;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    transition: box-shadow .2s;
}

.nav-prev:hover,.nav-next:hover { box-shadow: var(--shadow-md); }
.nav-next { text-align: right; }
.nav-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--c-muted); margin-bottom: 4px; }
.nav-title { font-size: .9rem; font-weight: 600; color: var(--c-primary); }

/* Related Posts */
.related-posts { margin: 40px 0; }
.section-sub-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--c-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--c-border);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.related-card {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    transition: box-shadow .2s;
}

.related-card:hover { box-shadow: var(--shadow-sm); }
.related-title { font-size: .9rem; font-weight: 600; color: var(--c-primary); margin-bottom: 4px; }
.related-date { font-size: .78rem; color: var(--c-muted); }

/* Comments */
.comments-section { margin: 40px 0; }

.comment-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }

.comment {
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 18px;
}

.comment-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author { font-weight: 600; color: var(--c-primary); }
.comment-date { font-size: .8rem; color: var(--c-muted); }
.comment-body { font-size: .95rem; color: var(--c-text); }
.no-comments { color: var(--c-muted); font-style: italic; margin-bottom: 24px; }

/* Comment Form */
.comment-form-wrap {
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 28px;
}

.form-title { font-size: 1rem; font-weight: 700; margin-bottom: 18px; color: var(--c-primary); }

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar-widget {
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.widget-title {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--c-primary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--c-border);
}

.sidebar-list { list-style: none; }
.sidebar-list li { padding: 6px 0; border-bottom: 1px solid var(--c-border); }
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list a { font-size: .9rem; color: var(--c-text); }
.sidebar-list a:hover { color: var(--c-accent); }

/* =========================================
   FORMS
   ========================================= */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: var(--font);
    outline: none;
    transition: border-color .2s;
    background: var(--c-white);
    color: var(--c-text);
}

.form-group input:focus,
.form-group textarea:focus { border-color: var(--c-accent); }

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

.captcha-group .form-group input { width: 120px; }

.card-form {
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 600px;
}

/* =========================================
   BUTTONS
   ========================================= */
.btn-primary {
    display: inline-block;
    padding: 10px 24px;
    background: var(--c-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    text-decoration: none;
    font-family: var(--font);
}

.btn-primary:hover { background: var(--c-accent); color: #fff; }

/* =========================================
   ALERTS
   ========================================= */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: .9rem;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: var(--c-success);
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: var(--c-error);
}

/* =========================================
   PAGINATION
   ========================================= */
.pagination {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 32px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius);
    font-size: .9rem;
    color: var(--c-text);
    background: var(--c-white);
    transition: border-color .2s, background .2s, color .2s;
}

.page-btn:hover { border-color: var(--c-accent); color: var(--c-accent); }
.page-btn.active {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
    font-weight: 700;
}

/* =========================================
   STATIC PAGE / NOT FOUND
   ========================================= */
.static-page { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 40px; }
.page-heading { font-size: 2rem; font-weight: 800; color: var(--c-primary); margin-bottom: 32px; }

.not-found { text-align: center; padding: 80px 20px; }
.not-found h1 { font-size: 6rem; font-weight: 900; color: var(--c-primary); opacity: .3; }
.not-found p { font-size: 1.2rem; color: var(--c-muted); margin: 20px 0 30px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--c-muted); }

/* =========================================
   FOOTER
   ========================================= */
.site-footer {
    background: var(--c-primary);
    color: rgba(255,255,255,.8);
    margin-top: 80px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    padding: 60px 0 40px;
}

.footer-brand .footer-logo img { height: 36px; filter: brightness(10); }
.logo-text-f { color: #fff; font-size: 1.2rem; font-weight: 700; }
.footer-desc { font-size: .9rem; color: rgba(255,255,255,.55); margin-top: 12px; line-height: 1.6; }

.footer-heading {
    color: #fff;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 16px;
    font-weight: 700;
}

.footer-links { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { font-size: .9rem; color: rgba(255,255,255,.6); transition: color .2s; }
.footer-links a:hover { color: #fff; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 20px 0;
    text-align: center;
    font-size: .85rem;
    color: rgba(255,255,255,.45);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 900px) {
    .content-grid { grid-template-columns: 1fr; }
    .sidebar-col { order: -1; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .nav-toggle { display: flex; }
    .nav-list {
        display: none;
        flex-direction: column;
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        background: var(--c-primary);
        padding: 12px;
        box-shadow: 0 8px 16px rgba(0,0,0,.2);
        z-index: 99;
    }
    .nav-list.open { display: flex; }
    .site-nav { position: relative; }

    .post-title { font-size: 1.5rem; }
    .form-row { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .post-navigation { flex-direction: column; }
    .related-grid { grid-template-columns: 1fr; }
}
