/* =========================================================
   Portfel Programisty — Global Styles
   ========================================================= */

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'DM Sans', 'Helvetica Neue', sans-serif; margin: 0; }
.font-mono { font-family: 'IBM Plex Mono', 'Cascadia Code', monospace !important; }
.font-display { font-family: 'Playfair Display', Georgia, serif !important; }

/* Loading screen */
.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
}
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(212, 160, 23, 0.2);
    border-top-color: #D4A017;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Blazor error UI */
#blazor-error-ui {
    background: #c0392b;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,.3);
    color: white;
    display: none;
    left: 0;
    padding: 10px 16px;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; font-weight: bold; }
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "Wystąpił błąd aplikacji."; }

/* Loading progress (Blazor boot) */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}
.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: #D4A017;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

/* Validation */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--mud-palette-primary, #D4A017); }
.invalid { outline: 1px solid #f44336; }
.validation-message { color: #f44336; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.5); }

/* Section scroll offset for fixed AppBar */
#o-mnie, #portfel, #blog, #kontakt { scroll-margin-top: 64px; }

/* Post card base hover (overridden by design-v3.css) */
.post-card { transition: transform 0.22s ease, box-shadow 0.22s ease; }

/* Gain/loss colors */
.gain-positive { color: #3FB950 !important; }
.gain-negative { color: #f44336 !important; }

/* Ticker / financial data */
.ticker-symbol { font-family: 'IBM Plex Mono', monospace; font-weight: 600; letter-spacing: 0.05em; }

/* Admin */
.cursor-pointer { cursor: pointer; }

/* Blog content */
.blog-content { line-height: 1.85; font-size: 1.05rem; font-family: 'DM Sans', sans-serif; }
.blog-content h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.7rem;
    border-bottom: 1px solid var(--mud-palette-divider);
    padding-bottom: 0.4rem;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.blog-content h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.35rem;
    margin-top: 2rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.blog-content h4, .blog-content h5, .blog-content h6 {
    font-family: 'DM Sans', sans-serif;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.blog-content p { margin-bottom: 1.25rem; }
.blog-content a { color: var(--mud-palette-primary); text-decoration: none; }
.blog-content a:hover { text-decoration: underline; }
.blog-content blockquote {
    margin: 1.75rem 0;
    padding: 1rem 1.5rem;
    border-left: 3px solid var(--mud-palette-primary);
    background: rgba(212, 160, 23, 0.05);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    font-family: 'Playfair Display', serif;
}
.blog-content code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875em;
    padding: 0.15em 0.4em;
    background: rgba(128, 128, 128, 0.15);
    border-radius: 4px;
}
.blog-content pre {
    padding: 1.25rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    overflow-x: auto;
    margin: 1.5rem 0;
}
.blog-content pre code { background: none; padding: 0; }
.blog-content img { max-width: 100%; border-radius: 8px; margin: 1rem 0; }
.blog-content ul, .blog-content ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.blog-content li { margin-bottom: 0.4rem; }
.blog-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.blog-content th, .blog-content td { padding: 0.6rem 1rem; border: 1px solid var(--mud-palette-divider); text-align: left; }
.blog-content th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.8; }

h1:focus { outline: none; }

@media (max-width: 600px) {
    .blog-content { font-size: 1rem; }
    .blog-content h2 { font-size: 1.4rem; }
    .blog-content h3 { font-size: 1.2rem; }
}
