:root {
    --bg-main: #f4f7fb;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-soft: #374151;
    --border-color: #e5e7eb;

    --accent-blue: #312e81;
    --accent-blue-light: #eef2ff;

    --accent-green: #059669;
    --accent-green-light: #ecfdf5;

    --accent-orange: #ea580c;
    --accent-orange-light: #fff7ed;

    --accent-purple: #9333ea;
    --accent-purple-light: #faf5ff;

    --accent-pink: #db2777;
    --accent-pink-light: #fdf2f8;

    --shadow-soft: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 0.875rem 1.75rem rgba(15, 23, 42, 0.12);
    --radius-lg: 1.125rem;
    --radius-md: 0.875rem;
    --radius-sm: 0.625rem;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-main);
    background: linear-gradient(180deg, #f7f9fc 0%, #edf2f8 100%);
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    background: #111827;
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    z-index: 1000;
    text-decoration: none;
}

.skip-link:focus,
.skip-link:focus-visible {
    top: 1rem;
}

.sr-only {
    position: absolute;
    width: 0.0625rem;
    height: 0.0625rem;
    padding: 0;
    margin: -0.0625rem;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.page-layout {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    max-width: 100rem;
    margin: 0 auto;
    padding: 1.25rem;
}

#main-content,
#content {
    flex: 1;
    min-width: 0;
    padding: 0.625rem 0;
}

#sidebar {
    width: 20rem;
    flex-shrink: 0;
    background: #ffffff;
    border: 0.0625rem solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 1.25rem;
}

#sidebar h2,
#sidebar h3 {
    margin-top: 0;
    color: var(--text-main);
}

#sidebar p,
#sidebar li {
    color: var(--text-soft);
}

#sidebar ul {
    padding-left: 1.125rem;
    margin-bottom: 1.375rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem 0;
}

.sidebar-menu li {
    margin-bottom: 0.625rem;
}

h1,
h2,
h3 {
    color: var(--text-main);
    margin-top: 0;
    line-height: 1.3;
}

h1 {
    font-size: 2.125rem;
    font-weight: 700;
    margin-bottom: 0.875rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.875rem;
}

h3 {
    font-size: 1.1875rem;
    font-weight: 700;
    margin-bottom: 0.625rem;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: 0.2s ease;
}

a:hover {
    color: #1e1b4b;
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 0.1875rem solid #111827;
    outline-offset: 0.1875rem;
}

.hero-block {
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    border: 0.0625rem solid #dbeafe;
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin: 0.625rem 0 1.875rem;
    box-shadow: var(--shadow-soft);
}

.hero-text {
    color: var(--text-soft);
    font-size: 1rem;
    margin-bottom: 1.375rem;
    max-width: 47.5rem;
}

.hero-search-form {
    margin-top: 0.875rem;
}

.hero-search-row {
    display: flex;
    gap: 0.875rem;
    flex-wrap: wrap;
    align-items: center;
}

.hero-search-row input[type="text"] {
    flex: 1;
    min-width: 17.5rem;
    padding: 0.8125rem 0.9375rem;
    border: 0.0625rem solid #cbd5e1;
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 0.9375rem;
}

.hero-search-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 0.1875rem rgba(79, 70, 229, 0.12);
}

button,
input[type="submit"] {
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

button:hover,
input[type="submit"]:hover {
    background: #3730a3;
}

.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18.125rem, 1fr));
    gap: 1.375rem;
    margin: 1.75rem 0;
}

.widget-card,
.post-preview,
.home-search-widget {
    background: var(--bg-card);
    border: 0.0625rem solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.375rem;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.widget-card:hover,
.post-preview:hover {
    transform: translateY(-0.1875rem);
    box-shadow: var(--shadow-hover);
}

.widget-card h2 {
    margin-bottom: 1rem;
}

.widget-latest {
    background: var(--accent-blue-light);
    border-left: 0.375rem solid var(--accent-blue);
}

.widget-comments {
    background: var(--accent-green-light);
    border-left: 0.375rem solid var(--accent-green);
}

.widget-likes {
    background: var(--accent-orange-light);
    border-left: 0.375rem solid var(--accent-orange);
}

.widget-categories {
    background: var(--accent-purple-light);
    border-left: 0.375rem solid var(--accent-purple);
}

.widget-recommended {
    background: var(--accent-pink-light);
    border-left: 0.375rem solid var(--accent-pink);
    margin-bottom: 1.875rem;
}

.widget-card ol,
.widget-card ul {
    margin: 0;
    padding-left: 1.375rem;
}

.widget-card li {
    margin-bottom: 0.875rem;
    line-height: 1.5;
}

.widget-card small {
    color: var(--text-soft);
    display: inline-block;
    margin-top: 0.1875rem;
    font-size: 0.875rem;
}

.widget-card small,
.post-preview .date,
small {
    color: #374151;
}

.section-title {
    margin: 2.125rem 0 1.25rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.post-preview {
    margin-bottom: 1.375rem;
    background: #ffffff;
}

.post-preview h2 {
    margin-bottom: 0.625rem;
    font-size: 1.5rem;
}

.post-preview .date {
    color: var(--text-soft);
    font-size: 0.875rem;
    margin-bottom: 0.625rem;
}

.post-preview p {
    margin-bottom: 0.75rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 0.0625rem solid #cbd5e1;
    border-radius: var(--radius-sm);
    background: #fff;
    box-sizing: border-box;
    font-size: 0.9375rem;
    margin-top: 0.25rem;
}

textarea {
    resize: vertical;
    min-height: 6.875rem;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 0.1875rem rgba(79, 70, 229, 0.12);
}

.pagination {
    margin: 1.875rem 0 0.625rem;
    padding: 1rem 1.125rem;
    background: #ffffff;
    border: 0.0625rem solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    text-align: center;
}

ul.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
}

ul.messages li {
    background: #ecfeff;
    border: 0.0625rem solid #a5f3fc;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

form {
    margin-bottom: 1rem;
}

small {
    color: var(--text-soft);
    font-size: 0.875rem;
}

.help-text-highlight {
    display: inline-block;
    margin-top: 0.375rem;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #fff3b0;
    color: #5c4400;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
}

.post-detail-card {
    background: #ffffff;
    border: 0.0625rem solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-soft);
}

.detail-breadcrumb {
    margin-bottom: 1.125rem;
    color: var(--text-soft);
    font-size: 0.875rem;
}

.detail-title {
    margin-bottom: 1.25rem;
}

.detail-meta-card,
.detail-body-card,
.detail-comments-card {
    background: #f9fafb;
    border: 0.0625rem solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.375rem;
}

.detail-btn {
    display: inline-block;
    padding: 0.625rem 1rem;
    border-radius: 0.625rem;
    font-weight: 600;
    text-decoration: none;
    color: white;
}

.detail-btn:hover {
    text-decoration: none;
    opacity: 0.92;
}

.detail-btn-primary {
    background: var(--accent-blue);
}

.detail-btn-secondary {
    background: #64748b;
}

.detail-btn-danger {
    background: #dc2626;
}

.detail-comments-list {
    padding-left: 1.25rem;
    margin: 0;
}

.detail-comments-list li {
    margin-bottom: 1rem;
}

.detail-comments-list span {
    color: var(--text-soft);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.form-page-card {
    background: #ffffff;
    border: 0.0625rem solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-soft);
}

.form-page-text {
    color: var(--text-soft);
    margin-bottom: 1.25rem;
}

.styled-form {
    margin-top: 0.625rem;
}

.form-field-block {
    margin-bottom: 1.125rem;
}

.form-field-block label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 600;
}

.form-field-block ul.errorlist {
    margin: 0.375rem 0 0;
    padding-left: 1.125rem;
    color: #b91c1c;
}

.delete-card {
    max-width: 53.125rem;
}

.delete-warning-box {
    background: #fef2f2;
    border: 0.0625rem solid #fecaca;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 1.125rem 0;
    color: #991b1b;
}

@media (max-width: 62.5rem) {
    .page-layout {
        flex-direction: column;
        padding: 0.9375rem;
    }

    #main-content,
    #content,
    #sidebar {
        width: 100%;
    }

    #sidebar {
        position: static;
    }

    .hero-block {
        padding: 1.5rem;
    }

    .hero-search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-search-row input[type="text"] {
        min-width: unset;
    }
}

@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .page-layout {
        display: block;
        max-width: none;
        padding: 0;
        margin: 0;
    }

    #sidebar,
    .no-print,
    .detail-actions,
    .detail-breadcrumb,
    .hero-block,
    .widgets-grid,
    .recommended-widget,
    .pagination,
    button,
    input[type="submit"],
    form,
    .skip-link {
        display: none !important;
    }

    #main-content,
    #content {
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .post-detail-card,
    .detail-meta-card,
    .detail-body-card,
    .detail-comments-card,
    .post-preview,
    .widget-card {
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 0 1rem 0 !important;
    }

    a {
        color: #000000 !important;
        text-decoration: none !important;
    }

    h1,
    h2,
    h3 {
        color: #000000 !important;
        page-break-after: avoid;
    }

    .detail-comments-list {
        padding-left: 1.125rem;
    }

    .detail-comments-list li {
        margin-bottom: 0.625rem;
    }
}

