/* Global Variables */
:root {
    --primary-color: #2563eb;
    /* blue-600 */
    --primary-hover: #1d4ed8;
    /* blue-700 */
    --primary-light: #3b82f6;
    /* blue-500 */
    --secondary-bg: #f3f4f6;
    /* gray-100 */
    --text-main: #1f2937;
    /* gray-800 */
    --text-muted: #4b5563;
    /* gray-600 */
    --text-light: #9ca3af;
    /* gray-400 */
    --white: #ffffff;
    --danger: #ef4444;
    /* red-500 */
    --success: #16a34a;
    /* green-600 */
    --warning: #ca8a04;
    /* yellow-600 */
    --purple: #9333ea;
    /* purple-600 */
    --border-color: #e5e7eb;
    /* gray-200 */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--secondary-bg);
    color: var(--text-main);
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Utilities */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

.hidden {
    display: none;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.w-full {
    width: 100%;
}

.text-center {
    text-align: center;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.rounded {
    border-radius: 0.25rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.shadow-md {
    box-shadow: var(--shadow);
}

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

.mt-8 {
    margin-top: 2rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.mr-4 {
    margin-right: 1rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

/* Navigation */
.navbar {
    background-color: var(--primary-color);
    padding: 1rem;
    color: var(--white);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-link {
    font-size: 0.875rem;
}

@media (min-width: 768px) {
    .nav-link {
        font-size: 1rem;
    }
}

/* Layout */
.main-layout {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .main-layout {
        flex-direction: row;
        gap: 1.5rem;
        /* 24px gap */
    }

    .sidebar {
        /* Fixed width for better consistency across screen sizes */
        flex: 0 0 280px;
        width: 280px;
        margin-bottom: 0;
        padding-right: 0;
        /* Remove padding hack, use gap */
    }

    .content-area {
        flex: 1;
        /* Take remaining space */
        width: auto;
        min-width: 0;
        /* Prevent flex overflow issues */
    }
}

.sidebar {
    width: 100%;
    margin-bottom: 1rem;
}

.content-area {
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
}

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

.btn-primary:hover {
    background-color: var(--primary-color);
    /* darker blue */
}

.btn-secondary {
    background-color: #6b7280;
    /* gray-500 */
    color: var(--white);
}

.btn-secondary:hover {
    background-color: var(--text-muted);
}

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

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    color: var(--text-main);
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.form-input,
.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.25;
    /* tight */
    color: var(--text-main);
    background-color: var(--white);
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* Cards & Grid */
.article-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.article-card {
    background-color: var(--white);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-body {
    padding: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.card-link {
    color: var(--primary-color);
    font-weight: 600;
}

.card-link:hover {
    text-decoration: underline;
}

/* Badges & Status */
.badge-new {
    background-color: var(--danger);
    color: var(--white);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

.text-status-s1 {
    color: var(--purple);
}

.text-status-s2 {
    color: var(--primary-color);
}

.text-status-s3 {
    color: var(--warning);
}

.text-status-s4 {
    color: var(--success);
}

.text-status-s5 {
    color: var(--danger);
}

.text-status-s6 {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.875rem;
}

.text-gray-600 {
    color: var(--text-muted);
}

/* Footer */
.footer {
    background-color: var(--secondary-bg);
    color: var(--text-muted);
    padding-top: 1rem;
    padding-bottom: 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-link {
    transition: color 0.3s;
}

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

/* Animations */
@keyframes blink {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

#typewriter::after {
    content: '|';
    animation: blink 0.7s infinite;
}

mark {
    background-color: yellow;
    padding: 2px;
    border-radius: 2px;
}

/* Content Page Specific */
.content-detail-container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: var(--white);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.content-html table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}

.content-html th,
.content-html td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
}

.content-html th {
    background-color: #f8fafc;
}

.leading-relaxed {
    line-height: 1.625;
}

/* Login Page Specific */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -64px;
    /* offset navbar height approx */
}

.login-card {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    width: 24rem;
    /* 96 */
}

.login-input {
    width: 75%;
    border-bottom: 2px solid #d1d5db;
    /* gray-300 */
    padding: 0.5rem 0.75rem;
    color: var(--text-main);
    line-height: 1.25;
    transition: border-color 0.3s;
    border-top: none;
    border-left: none;
    border-right: none;
    background: transparent;
}

.login-input:focus {
    outline: none;
    border-color: var(--primary-light);
}

.login-label {
    width: 25%;
    text-align: right;
    margin-right: 1rem;
    color: var(--text-main);
}

/* Toast Notification */
.toast-notification {
    background-color: var(--primary-light);
    color: var(--white);
    padding: 0.75rem;
    border-radius: 0.25rem;
    box-shadow: var(--shadow);
    transition: all 0.5s ease-in-out;
    opacity: 0;
    transform: translateY(-50%) translateX(100%);
    position: fixed;
    top: 12%;
    right: 0;
    z-index: 1000;
    max-width: 200px;
    text-align: center;
}

.toast-visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}