/* ===== Blog Styles ===== */

/* --- Blog page --- */
.blog-hero {
    background: linear-gradient(135deg, #064515 0%, #21A038 100%);
    padding: 120px 0 60px;
    text-align: center;
    color: #fff;
}

.blog-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.blog-hero p {
    font-size: 1.1rem;
    opacity: 0.85;
}

/* Filters */
.blog-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 32px 0;
    flex-wrap: wrap;
}

.blog-filter {
    padding: 10px 24px;
    border: 2px solid #E5E7EB;
    border-radius: 50px;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1A1A1A;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.blog-filter:hover {
    border-color: #21A038;
    color: #21A038;
}

.blog-filter.active {
    background: #21A038;
    border-color: #21A038;
    color: #fff;
}

/* Blog grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    padding-bottom: 48px;
}

.blog-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.10);
}

.blog-card__cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f0f0f0;
}

.blog-card__body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.82rem;
    color: #6B7280;
}

.blog-card__category {
    background: #E8F5E9;
    color: #21A038;
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.blog-card__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.35;
    color: #1A1A1A;
}

.blog-card__desc {
    font-size: 0.92rem;
    color: #6B7280;
    line-height: 1.5;
    flex: 1;
}

.blog-card__footer {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.blog-card__author {
    font-size: 0.82rem;
    color: #9CA3AF;
}

.blog-card__readmore {
    font-size: 0.9rem;
    font-weight: 600;
    color: #21A038;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Pagination */
.blog-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px 0 48px;
}

.blog-pagination button {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 2px solid #E5E7EB;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    color: #1A1A1A;
}

.blog-pagination button:hover {
    border-color: #21A038;
    color: #21A038;
}

.blog-pagination button.active {
    background: #21A038;
    border-color: #21A038;
    color: #fff;
}

.blog-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6B7280;
    font-size: 1.1rem;
}

/* --- Article page --- */
.article-hero {
    position: relative;
    height: 400px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
}

.article-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 100%);
}

.article-hero__content {
    position: relative;
    z-index: 1;
    padding: 40px 20px;
    color: #fff;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
}

.article-hero__category {
    display: inline-block;
    background: #21A038;
    color: #fff;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.article-hero__title {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 12px;
}

.article-hero__meta {
    font-size: 0.9rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.article-hero__separator {
    opacity: 0.5;
}

.article-hero__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.article-hero__meta-item svg {
    opacity: 0.7;
    flex-shrink: 0;
}

/* Author bar */
.article-author-bar {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.article-author-bar__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.article-author-bar__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #21A038;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.article-author-bar__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-author-bar__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.article-author-bar__name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1A1A1A;
    position: relative;
}

.article-author-bar__name[data-tooltip] {
    cursor: help;
}

.article-author-bar__name[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    background: #1A1A1A;
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 400;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.article-author-bar__name[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    left: 12px;
    top: calc(100% + 1px);
    border: 5px solid transparent;
    border-bottom-color: #1A1A1A;
    z-index: 10;
    pointer-events: none;
}

.article-author-bar__details {
    font-size: 0.82rem;
    color: #6B7280;
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-author-bar__dot {
    opacity: 0.4;
}

.article-author-bar__icon {
    flex-shrink: 0;
    opacity: 0.5;
    vertical-align: -2px;
}

/* Article layout */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 40px;
    padding: 48px 0;
    max-width: 1100px;
    margin: 0 auto;
}

/* Article content typography */
.article-content {
    min-width: 0;
}

.article-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 36px 0 16px;
    color: #1A1A1A;
    padding-bottom: 8px;
    border-bottom: 2px solid #E8F5E9;
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 28px 0 12px;
    color: #1A1A1A;
}

.article-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 20px 0 8px;
}

.article-content p {
    margin: 0 0 16px;
    line-height: 1.75;
    color: #333;
}

.article-content ul,
.article-content ol {
    margin: 0 0 16px;
    padding-left: 24px;
    list-style: disc;
}

.article-content ol {
    list-style: decimal;
}

.article-content li {
    margin-bottom: 6px;
    line-height: 1.6;
    color: #333;
}

.article-content strong {
    font-weight: 700;
    color: #1A1A1A;
}

.article-content a {
    color: #21A038;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(33, 160, 56, 0.4);
    font-weight: 500;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.article-content a:hover {
    color: #1a8a30;
    text-decoration-color: #1a8a30;
}

.article-content blockquote {
    border-left: 4px solid #21A038;
    margin: 20px 0;
    padding: 12px 20px;
    background: #F7F8FA;
    border-radius: 0 10px 10px 0;
    color: #333;
    font-style: italic;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95rem;
}

.article-content th,
.article-content td {
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    text-align: left;
}

.article-content th {
    background: #E8F5E9;
    font-weight: 600;
    color: #064515;
}

.article-content pre {
    background: #1A1A1A;
    color: #E8F5E9;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 20px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.article-content code {
    background: #F0F0F0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content img {
    max-width: 100%;
    border-radius: 10px;
    margin: 20px 0;
}

.article-content hr {
    border: none;
    border-top: 2px solid #E5E7EB;
    margin: 32px 0;
}

/* Sidebar */
.article-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
}

.sidebar-toc {
    background: #F7F8FA;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.sidebar-toc h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: #1A1A1A;
}

.sidebar-toc ul {
    list-style: none;
    padding: 0;
}

.sidebar-toc li {
    margin-bottom: 8px;
}

.sidebar-toc a {
    font-size: 0.88rem;
    color: #6B7280;
    text-decoration: none;
    transition: color 0.2s;
    line-height: 1.4;
    display: block;
}

.sidebar-toc a:hover,
.sidebar-toc a.active {
    color: #21A038;
}

.sidebar-related {
    background: #F7F8FA;
    border-radius: 16px;
    padding: 24px;
}

.sidebar-related h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: #1A1A1A;
}

.sidebar-related__item {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 10px 0;
    border-bottom: 1px solid #E5E7EB;
}

.sidebar-related__item:last-child {
    border-bottom: none;
}

.sidebar-related__item:hover .sidebar-related__title {
    color: #21A038;
}

.sidebar-related__date {
    font-size: 0.78rem;
    color: #6B7280;
}

.sidebar-related__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1A1A1A;
    transition: color 0.2s;
    line-height: 1.35;
}

/* Back link */
.article-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #21A038;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    padding: 20px 0 0;
}

.article-back:hover {
    text-decoration: underline;
}

/* Admin styles */
.admin-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 32px;
    padding: 32px 0;
    min-height: calc(100vh - 200px);
}

.admin-list {
    background: #F7F8FA;
    border-radius: 16px;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 240px);
}

.admin-list h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.admin-article-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.admin-article-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.admin-article-item.active {
    border-left: 3px solid #21A038;
}

.admin-article-item__title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1A1A1A;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-article-item__date {
    font-size: 0.75rem;
    color: #6B7280;
}

.admin-article-item__actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.admin-article-item__actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    border-radius: 4px;
    color: #6B7280;
}

.admin-article-item__actions button:hover {
    background: #fee;
    color: #e53e3e;
}

.admin-editor {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.admin-editor h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.admin-form {
    display: grid;
    gap: 16px;
}

.admin-form label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1A1A1A;
    display: block;
    margin-bottom: 4px;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    border-color: #21A038;
    outline: none;
}

.admin-form textarea {
    min-height: 300px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.88rem;
    line-height: 1.5;
    resize: vertical;
}

.admin-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.admin-form__actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.admin-btn {
    padding: 10px 24px;
    border-radius: 10px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.admin-btn--primary {
    background: #21A038;
    color: #fff;
}

.admin-btn--primary:hover {
    background: #1A8A2E;
}

.admin-btn--secondary {
    background: #F7F8FA;
    color: #1A1A1A;
    border: 2px solid #E5E7EB;
}

.admin-btn--secondary:hover {
    border-color: #21A038;
}

.admin-btn--danger {
    background: #fee;
    color: #e53e3e;
}

.admin-btn--danger:hover {
    background: #e53e3e;
    color: #fff;
}

.admin-preview {
    margin-top: 24px;
    padding: 24px;
    background: #F7F8FA;
    border-radius: 16px;
    max-height: 500px;
    overflow-y: auto;
}

.admin-preview h3 {
    margin-bottom: 16px;
}

.admin-status {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 10px;
}

.admin-status--success {
    background: #E8F5E9;
    color: #064515;
}

.admin-status--error {
    background: #fee;
    color: #e53e3e;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .article-layout {
        grid-template-columns: 1fr;
        padding: 32px 20px;
    }
    .article-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .admin-list {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .blog-hero {
        padding: 100px 0 40px;
    }
    .blog-hero h1 {
        font-size: 1.8rem;
    }
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .blog-filters {
        gap: 8px;
        padding: 20px 0;
    }
    .blog-filter {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    .article-hero {
        height: 280px;
    }
    .article-hero__content {
        padding: 20px;
    }
    .article-hero__title {
        font-size: 1.5rem;
    }
    .article-layout {
        padding: 24px 16px;
    }
    .article-sidebar {
        grid-template-columns: 1fr;
    }
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .admin-form__row {
        grid-template-columns: 1fr;
    }
}

/* ===== Article inline forms & calculators ===== */
.article-form {
    background: linear-gradient(135deg, #f0faf2 0%, #e8f5e9 100%);
    border: 1px solid #c8e6c9;
    border-radius: 16px;
    padding: 36px 32px;
    margin: 48px 0 32px;
}
.article-form__icon {
    width: 48px;
    height: 48px;
    background: #21A038;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.article-form__icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
}
.article-form__title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 6px;
}
.article-form__desc {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.5;
}
.article-form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
.article-form__group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.article-form__group--full {
    grid-column: 1 / -1;
}
.article-form__label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #444;
}
.article-form__input,
.article-form__select,
.article-form__textarea {
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.article-form__input:focus,
.article-form__select:focus,
.article-form__textarea:focus {
    outline: none;
    border-color: #21A038;
    box-shadow: 0 0 0 3px rgba(33,160,56,0.1);
}
.article-form__textarea {
    resize: vertical;
    min-height: 70px;
}
.article-form__submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #21A038;
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}
.article-form__submit:hover {
    background: #1a8a30;
}
.article-form__submit:active {
    transform: scale(0.97);
}
.article-form__note {
    font-size: 0.78rem;
    color: #888;
    margin-top: 10px;
}

/* Calculator specific */
.article-calc__result {
    background: #fff;
    border: 2px solid #21A038;
    border-radius: 12px;
    padding: 20px 24px;
    margin: 20px 0 8px;
    text-align: center;
    display: none;
}
.article-calc__result.visible {
    display: block;
    animation: calcFadeIn 0.3s ease;
}
@keyframes calcFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.article-calc__result-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
}
.article-calc__result-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #21A038;
}
.article-calc__result-note {
    font-size: 0.8rem;
    color: #888;
    margin-top: 6px;
}
.article-calc__range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.article-calc__range-row input[type="range"] {
    flex: 1;
    accent-color: #21A038;
}
.article-calc__range-val {
    min-width: 60px;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: right;
    color: #1a1a2e;
}
.article-form__radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.article-form__radio {
    display: none;
}
.article-form__radio-label {
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #444;
}
.article-form__radio:checked + .article-form__radio-label {
    background: #21A038;
    color: #fff;
    border-color: #21A038;
}
.article-form__success {
    background: #21A038;
    color: #fff;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    display: none;
}
.article-form__success.visible {
    display: block;
    animation: calcFadeIn 0.3s ease;
}
.article-form__success h4 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}
.article-form__success p {
    opacity: 0.9;
    font-size: 0.9rem;
}
@media (max-width: 600px) {
    .article-form {
        padding: 24px 18px;
    }
    .article-form__grid {
        grid-template-columns: 1fr;
    }
    .article-calc__result-value {
        font-size: 1.4rem;
    }
}
