/**
 * Minelist clone - custom component styles
 * Tailwind handles utilities; this file adds component classes from the original design.
 */

/* Minelist-style fonts: Noto Sans (body), Minecraft Ten (headings/nav), Minecraft Seven (numeric/UI) */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

/* Minecraft Ten: loaded from assets/fonts/ (path relative to this CSS file)
   font-display: optional = use font only if already available (e.g. from cache), avoids flash on navigation */
@font-face {
    font-family: 'Minecraft Ten';
    src: url('../fonts/MinecraftTen-VGORe.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: optional;
}
/* Minecraft Seven: optional 7-segment style; add MinecraftSeven.woff2 to assets/fonts/ to enable */
@font-face {
    font-family: 'Minecraft Seven';
    src: url('../fonts/MinecraftSeven.woff2') format('woff2'),
         url('../fonts/MinecraftSeven.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: optional;
}

:root {
    --color-primary: #7ccf00;   /* lime-500 – main lime */
    --color-accent: #7ccf00;
    --color-accent-border: #35530e;   /* lime-900 – border */
    --color-accent-shadow: #35530e;
    --color-border: rgba(0,0,0,0.1);
    --wrapper-max: 1280px;
    --color-secondary: rgb(214 211 209);   /* stone-300 */
    --color-secondary-foreground: rgb(28 25 23);
    --color-muted-foreground: rgb(120 113 108);
    --font-sans: 'Noto Sans', ui-sans-serif, system-ui, sans-serif;
    --font-minecraft-ten: 'Minecraft Ten', ui-monospace, monospace;
    --font-minecraft-seven: 'Minecraft Seven', ui-monospace, monospace;
    /* Top loading bar */
    --bprogress-color: #7ccf00;
    --bprogress-height: 2px;
    --bprogress-box-shadow: 0 0 10px #7ccf00, 0 0 5px #7ccf00;
    --bprogress-z-index: 99999;
}

.dark {
    /* Dark stone border (no white) – aligns with Minelist dark theme */
    --color-border: rgb(68 64 60);
    --color-secondary: rgb(68 64 60);     /* stone-700 */
    --color-secondary-foreground: rgb(245 245 244);
    --color-muted-foreground: rgb(168 162 158);
}

/* Smoother tab switching and in-page scroll */
html {
    scroll-behavior: smooth;
    /* Reserve space for scrollbar so layout does not shift left/right when switching dashboard tabs */
    overflow-y: scroll;
}
@supports (scrollbar-gutter: stable) {
    html {
        overflow-y: auto;
        scrollbar-gutter: stable;
    }
}

/* Dashboard: reduce layout shift when switching tabs; scroll-margin so content isn’t under sticky nav */
#dashboard-section {
    scroll-margin-top: 5.5rem;
}

/* Admin panel: allow layout toggle to control width (navbar, content, footer) */
body.admin-page .wrapper {
    max-width: var(--wrapper-max);
}
/* Admin: ensure main and section use full width */
main:has(#admin-section) {
    max-width: none;
    width: 100%;
}
#admin-section.wrapper {
    max-width: var(--wrapper-max);
    width: 100%;
    box-sizing: border-box;
}

/* Layout */
.wrapper {
    width: 100%;
    max-width: var(--wrapper-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Full-width layout toggle (navbar button): wider width via --wrapper-max (normal = 1280px in :root) */
body.layout-full-width {
    --wrapper-max: 95%;
}

@media (min-width: 1024px) {
    .wrapper { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* Accent (primary CTA) buttons: lime-500 bg, lime-900 border, white text */
.bg-accent {
    background-color: #7ccf00;
}
.border-accent {
    border-color: #35530e;
}
.btn-accent.btn-wrapper::before {
    background-color: var(--color-accent-shadow);
    border-color: var(--color-accent-border);
}
.btn-accent .btn-surface {
    background-color: #7ccf00;
    border-color: #35530e;
    color: #fff;
}

/* Button block (accent / stone / yellow) - 3D effect */
.btn-wrapper {
    position: relative;
    transition: transform 0.15s, opacity 0.2s;
}
.btn-wrapper:active .btn-surface { transform: translateY(2px); }
.btn-wrapper::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    border-radius: 0.375rem;
    border-width: 2px;
    border-bottom-width: 3px;
    z-index: 0;
}
.btn-wrapper .btn-surface {
    position: relative;
    z-index: 1;
    transition: transform 0.1s;
}

/* Minecraft-style font for headings (uses CSS variable for theming / font loading) */
.font-minecraft {
    font-family: var(--font-minecraft-ten);
    font-weight: normal;
}

/* Minelist-style 7-segment / numeric UI font */
.font-minecraft-seven {
    font-family: var(--font-minecraft-seven);
}

/* Dashboard auth link (e.g. "Add your first server here") */
.auth-link {
    color: var(--color-primary);
    font-weight: 600;
}
.auth-link:hover {
    text-decoration: underline;
}

/* Muted foreground (bar track, secondary text) - matches reference design */
.bg-muted-foreground {
    background-color: #71717a;
}
.dark .bg-muted-foreground {
    background-color: #52525b;
}

/* Share this server: white icons on colored buttons (ShareThis CDN SVGs are dark) */
.share-this-server .st-btn img {
    filter: brightness(0) invert(1);
}

/* Hide scrollbar but keep scroll */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Step cards - how to start */
.step-card {
    position: relative;
    border-radius: 0.125rem;
    overflow: hidden;
    min-height: 240px;
}
.step-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}
.step-card-overlay {
    position: absolute;
    inset: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
}
.step-card-overlay--lime { --step-accent: #7ccf00; }
.step-card-overlay--red { --step-accent: #dc2626; }
.step-card-overlay--sky { --step-accent: #0ea5e9; }
.step-number {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--step-accent, #84cc16);
    margin-bottom: 0.25rem;
}
.step-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}
.step-description {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.8);
    margin-top: 0.25rem;
}
.step-decoration {
    position: absolute;
    background: rgba(255,255,255,0.15);
    border-radius: 0.125rem;
}

/* Footer link hover */
.footer-link-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.footer-link {
    transition: color 0.15s;
}
.footer-link:hover {
    color: #1c1917;
}
.dark .footer-link:hover {
    color: #fafaf9;
}

/* Selects: prevent text/descenders (g, y, p, q, j) from being clipped */
select {
    min-height: 2.5rem;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
    line-height: 1.4;
    box-sizing: border-box;
}

/* Line clamp */
.line-clamp-1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Rounded small */
.rounded-xs {
    border-radius: 0.125rem;
}

/* Nav dropdown */
.nav-dropdown-trigger[data-state="open"] .nav-dropdown-chevron {
    transform: rotate(180deg);
}
.nav-dropdown-viewport[data-state="closed"] {
    visibility: hidden;
    opacity: 0;
    max-height: 0;
    min-height: 0;
    border-width: 0;
}
.nav-dropdown-viewport[data-state="open"] {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    min-height: 320px;
    max-height: 90vh;
    overflow-x: auto;
    overflow-y: auto;
}
.nav-dropdown-viewport .nav-dropdown-panel:not([hidden]) {
    pointer-events: auto;
    display: block;
}

/* Account dropdown (right-aligned under icon) */
.account-dropdown-panel:not([hidden]) {
    pointer-events: auto;
}

/* Minecraft Realms Server List button (Realms branding: purple panel + white text/border) */
.nav-realms-btn,
a.nav-realms-btn {
    background: linear-gradient(180deg, #4a0d6e 0%, #2d0047 100%);
    color: #fff !important;
    border-color: #d946ef;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 1px 0 rgba(255, 180, 255, 0.15), 0 2px 6px rgba(0, 0, 0, 0.25);
}
.nav-realms-btn:hover,
a.nav-realms-btn:hover {
    background: linear-gradient(180deg, #5c1585 0%, #3d0060 100%);
    color: #fff !important;
    border-color: #e879f2;
    box-shadow: inset 0 1px 0 rgba(255, 200, 255, 0.2), 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 16px rgba(217, 70, 239, 0.25);
}

/* Blog entry: force heading levels so h1/h2/h3 look like headings (override Tailwind preflight) */
.blog-entry-body h1,
.block-parser.prose h1,
.block-parser.prose .prose h1 { font-size: 1.5rem !important; font-weight: 700 !important; margin-top: 1.5em; margin-bottom: 0.5em; line-height: 1.3; color: inherit; }
.blog-entry-body h2,
.block-parser.prose h2,
.block-parser.prose .prose h2 { font-size: 1.25rem !important; font-weight: 700 !important; margin-top: 1.25em; margin-bottom: 0.5em; line-height: 1.3; color: inherit; }
.blog-entry-body h3,
.block-parser.prose h3,
.block-parser.prose .prose h3 { font-size: 1.125rem !important; font-weight: 600 !important; margin-top: 1em; margin-bottom: 0.5em; color: inherit; }
.blog-entry-body h4,
.block-parser.prose h4,
.block-parser.prose .prose h4 { font-size: 1rem !important; font-weight: 600 !important; margin-top: 0.75em; margin-bottom: 0.25em; color: inherit; }
.blog-entry-body h1:first-child,
.blog-entry-body h2:first-child,
.blog-entry-body h3:first-child,
.block-parser.prose h1:first-child,
.block-parser.prose h2:first-child,
.block-parser.prose h3:first-child,
.block-parser.prose .prose h1:first-child,
.block-parser.prose .prose h2:first-child,
.block-parser.prose .prose h3:first-child { margin-top: 0; }

/* Blog entry: Quill alignment (override parent text-justify and prose) */
.blog-entry-body .ql-align-left,
.blog-entry-body p.ql-align-left,
.block-parser .ql-align-left,
.block-parser p.ql-align-left { text-align: left !important; }
.blog-entry-body .ql-align-center,
.blog-entry-body p.ql-align-center,
.block-parser .ql-align-center,
.block-parser p.ql-align-center { text-align: center !important; }
.blog-entry-body .ql-align-right,
.blog-entry-body p.ql-align-right,
.block-parser .ql-align-right,
.block-parser p.ql-align-right { text-align: right !important; }
.blog-entry-body .ql-align-justify,
.blog-entry-body p.ql-align-justify,
.block-parser .ql-align-justify,
.block-parser p.ql-align-justify { text-align: justify !important; }

/* Blog entry: borders in article content use stone (no white in dark theme) */
.block-parser img,
.block-parser figure img {
    border-color: rgb(214 211 209);
}
.dark .block-parser img,
.dark .block-parser figure img {
    border-color: rgb(68 64 60);
}
.block-parser hr,
.prose hr {
    border-color: rgb(214 211 209);
}
.dark .block-parser hr,
.dark .prose hr {
    border-color: rgb(68 64 60);
}

/* Search dialog – solid background so it’s not see-through on light theme */
.search-dialog-content {
    background-color: #fff;
}
.dark .search-dialog-content {
    background-color: rgba(28, 25, 23, 0.95);
}
.search-dialog[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
}

/* Top loading bar (Minelist-style) */
.bprogress {
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: var(--bprogress-z-index);
}

.bprogress .bar {
    background: var(--bprogress-color);
    position: fixed;
    z-index: var(--bprogress-z-index);
    top: 0;
    left: 0;
    width: 0;
    height: var(--bprogress-height);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.bprogress--complete .bar {
    width: 100%;
}

/* Fade out and hide so the bar is fully invisible before we reset width in JS */
.bprogress--resetting .bar {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease-out;
}

/* Peg (glow at bar end) – hidden for bar-only indicator to avoid full-height green strip */
.bprogress .peg {
    display: none;
}

.bprogress .spinner {
    display: block;
    position: fixed;
    z-index: var(--bprogress-z-index);
    top: var(--bprogress-spinner-top);
    bottom: var(--bprogress-spinner-bottom);
    right: var(--bprogress-spinner-right);
    left: var(--bprogress-spinner-left);
}

.bprogress .spinner-icon {
    width: var(--bprogress-spinner-size);
    height: var(--bprogress-spinner-size);
    box-sizing: border-box;
    border: solid var(--bprogress-spinner-border-size) transparent;
    border-top-color: var(--bprogress-color);
    border-left-color: var(--bprogress-color);
    border-radius: 50%;
    animation: bprogress-spinner var(--bprogress-spinner-animation-duration) linear infinite;
}

.bprogress .indeterminate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--bprogress-height);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

.bprogress--active .indeterminate {
    opacity: 1;
}

.bprogress--complete .indeterminate {
    opacity: 0;
}

.bprogress .indeterminate .inc,
.bprogress .indeterminate .dec {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: var(--bprogress-color);
}

/* Only forward (left-to-right) motion so the bar never moves backwards */
.bprogress .indeterminate .inc {
    animation: bprogress-indeterminate-increase 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.bprogress .indeterminate .dec {
    display: none;
}

@keyframes bprogress-indeterminate-increase {
    from { left: -5%; width: 5%; }
    to { left: 130%; width: 100%; }
}

/* On mobile, listing card banner images/videos use contain rather than cropping (override Tailwind) */
@media (max-width: 767px) {
    img.listing-banner-media,
    video.listing-banner-media {
        object-fit: contain !important;
    }
    .listing-card a img.listing-banner-media,
    .listing-card a video.listing-banner-media {
        object-fit: contain !important;
    }
}
