/* ===========================================
   BASE STYLES - Global styles for all pages
   =========================================== */

:root {
    --bg: #e8eaed;
    --card: #ffffff;
    --muted: #6b7280;
    --border: #d1d5db;
    --accent: #3b82f6;
    --accent-contrast: #ffffff;
    --max-width: 920px;
}

* {
    box-sizing: border-box
}

html {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    margin: 0;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 50%, #94a3b8 100%);
    background-attachment: fixed;
    color: #111827;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.container {
    margin: 0;
    padding: 20px;
    width: 100%;
}

main.container {
    flex: 1;
}

/* Remove container padding on post page for edge-to-edge article */
body:has(.article-wrapper) .container:not(header .container) {
    padding: 0;
}

/* Ensure header container keeps its padding on post page */
body:has(.article-wrapper) header .container {
    padding: 16px 20px;
}

/* Base Card Styles */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
}

/* Header */
header {
    background: #0f172a;
    padding: 0;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.4);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

header .container {
    padding: 12px 20px;
}

header nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff !important;
    letter-spacing: -0.5px;
    padding: 4px 0 !important;
    flex-shrink: 0;
}

.nav-brand:hover {
    color: #3b82f6 !important;
}

.nav-links {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

header a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 6px 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

header a:hover {
    color: #ffffff;
}

/* Header logo */
.logo-link {
    display: inline-flex;
    align-items: center;
    margin-right: 8px
}

.header-logo {
    height: 100px;
    width: 100px;
    vertical-align: middle
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--accent);
}

/* Flash Messages */
.flashes {
    list-style: none;
    padding: 0;
    margin: 8px 0;
    color: #991b1b
}

/* Typography */
h1,
h2,
h3 {
    margin: 0 0 8px 0
}

p {
    margin: 0 0 12px 0
}

/* Forms */
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 12px;
    font-family: inherit;
}

textarea.form-control {
    min-height: 90px
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.95rem
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: var(--accent-contrast);
    cursor: pointer;
    font-weight: 600
}

.btn.secondary {
    background: #f3f4f6;
    color: #111827;
    border: 1px solid var(--border)
}

.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-contrast)
}

.btn-secondary {
    background: #f3f4f6;
    color: #111827;
    border: 1px solid var(--border)
}

.btn-danger {
    background: #dc2626;
    color: #ffffff
}

.btn-disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed
}

/* Utilities */
.muted {
    color: var(--muted)
}

.small {
    font-size: 0.88rem
}

.align-right {
    margin-left: auto
}

.center {
    text-align: center
}

/* VIP Badge */
.vip {
    display: inline-block;
    background: #ffd700;
    color: #222;
    font-weight: 600;
    padding: 2px 8px;
    margin-left: 8px;
    border-radius: 999px;
    font-size: 0.8rem
}

/* Author / OP badge */
.author-badge {
    display: inline-block;
    background: #eef2ff;
    color: #05307a;
    font-weight: 600;
    padding: 2px 8px;
    margin-left: 8px;
    border-radius: 999px;
    font-size: 0.78rem
}

/* OP label */
.op-label {
    color: var(--accent);
    font-weight: 700;
    margin-left: 8px;
    font-size: 0.9rem
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px
}

/* Add Post Button */
.btn-add-post {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
}

.btn-add-post:hover {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
}

/* Quick Start Button */
.btn-quick-start {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-quick-start .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-quick-start .spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.btn-quick-start:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-quick-start:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Credentials Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 16px;
}

.modal-icon-wrapper {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.modal-icon {
    width: 32px;
    height: 32px;
    color: white;
}

.modal-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.5rem;
}

.modal-subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.credentials-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.credential-row {
    margin-bottom: 12px;
}

.credential-row:last-child {
    margin-bottom: 0;
}

.credential-row label {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.credential-value {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
}

.credential-value span {
    flex: 1;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.copy-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.copy-btn .copy-icon,
.copy-btn .check-icon {
    width: 18px;
    height: 18px;
}

.copy-btn .check-icon {
    display: none;
    color: #10b981;
}

.copy-btn.copied .copy-icon {
    display: none;
}

.copy-btn.copied .check-icon {
    display: block;
}

.modal-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #d97706;
    font-size: 0.85rem;
    margin-bottom: 20px;
    padding: 10px 12px;
    background: #fef3c7;
    border-radius: 8px;
}

.modal-warning .warning-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.modal-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    border-radius: 10px;
}

/* Responsive */
@media (max-width:800px) {
    .container {
        padding: 14px
    }

    body:has(.article-wrapper) .container:not(header .container) {
        padding: 0;
    }

    header .container {
        padding: 10px 14px;
    }

    .nav-brand {
        font-size: 1.25rem;
    }

    .nav-links {
        gap: 4px;
    }

    header a {
        padding: 5px 8px;
        font-size: 0.8rem;
    }

    .header-logo {
        height: 70px;
        width: 70px;
    }
}

@media (max-width:480px) {
    .container {
        padding: 10px
    }

    body:has(.article-wrapper) .container:not(header .container) {
        padding: 0;
    }

    .card {
        padding: 12px;
        border-radius: 12px;
    }

    header .container {
        padding: 8px 10px;
    }

    header nav {
        gap: 6px;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-links {
        gap: 2px;
    }

    header a {
        padding: 4px 6px;
        font-size: 0.75rem;
    }

    .header-logo {
        height: 50px;
        width: 50px;
    }

    .modal-content {
        padding: 24px 20px;
    }

    .btn-quick-start {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}

/* ===========================================
   FOOTER STYLES
   =========================================== */

.site-footer {
    background: #0f172a;
    color: rgba(255, 255, 255, 0.85);
    margin-top: auto;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px 20px;
}

.footer-main {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 30px;
}

.footer-brand {
    flex-shrink: 0;
}

.footer-logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.footer-tagline {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin-top: 6px;
}

.footer-links {
    display: flex;
    gap: 60px;
}

.footer-section h4 {
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
}

.footer-section a {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: #3b82f6;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin: 0;
}

@media (max-width: 600px) {
    .footer-container {
        padding: 30px 16px 16px;
    }

    .footer-main {
        flex-direction: column;
        gap: 24px;
    }

    .footer-links {
        gap: 40px;
    }

    .footer-section h4 {
        margin-bottom: 8px;
    }
}