/* Shared styling for all human-facing API pages: the docs page
   (app/Views/api.php) and the live-data views rendered directly from
   App\Controllers\Api\Status, Currencies and Blocks when a browser
   (not curl/a bot) requests /status, /currencies, /blocks or /wallet. */

:root {
    --cxp-accent: #6C5CE7;
    --cxp-accent-2: #00D9C0;
    --cxp-accent-gradient: linear-gradient(135deg, #6C5CE7 0%, #00B8D9 55%, #00D9C0 100%);
    --cxp-radius: 14px;
}

body {
    background: linear-gradient(165deg, #0f1120 0%, #171b2b 60%, #171b2b 100%) !important;
    color: #e5e7eb;
}

html {
    scroll-behavior: smooth;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.api-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    margin: 0 -15px;
    background: rgba(15, 17, 30, .88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(108, 92, 231, .2);
}
.api-navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: .7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.api-navbar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    white-space: nowrap;
}
.api-navbar-brand:hover {
    color: #fff;
    text-decoration: none;
}
.api-navbar-brand img {
    height: 32px;
    width: 32px;
    object-fit: contain;
    border-radius: 8px;
}
.api-navbar-brand small {
    color: var(--cxp-accent-2);
    font-weight: 700;
    font-size: .7rem;
    letter-spacing: .5px;
    vertical-align: middle;
}
.api-navbar-links {
    display: flex;
    align-items: center;
    gap: 1.6rem;
}
.api-nav-link {
    position: relative;
    color: rgba(255, 255, 255, .72);
    text-decoration: none;
    font-weight: 600;
    font-size: .88rem;
    padding: .3rem 0;
    transition: color .2s ease;
}
.api-nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 2px;
    border-radius: 2px;
    background: var(--cxp-accent-gradient);
    transform: scaleX(0);
    transition: transform .2s ease;
}
.api-nav-link:hover,
.api-nav-link.active {
    color: #fff;
    text-decoration: none;
}
.api-nav-link:hover::after,
.api-nav-link.active::after {
    transform: scaleX(1);
}
.api-nav-cta {
    background: var(--cxp-accent-gradient);
    color: #fff !important;
    padding: .45rem 1.1rem;
    border-radius: 999px;
    font-size: .82rem;
}
.api-nav-cta::after {
    display: none;
}
.api-navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 34px;
    height: 34px;
    background: none;
    border: 1px solid rgba(108, 92, 231, .3);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
}
.api-navbar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
}
.api-navbar-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.api-navbar-toggle.open span:nth-child(2) {
    opacity: 0;
}
.api-navbar-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   HERO
   ============================================================ */
.api-hero {
    position: relative;
    margin: 0 -15px;
    text-align: center;
    padding: 3.2rem 1.5rem 2.4rem;
    overflow: hidden;
}
.api-hero::before {
    content: "";
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    height: 240px;
    background: radial-gradient(closest-side, rgba(108, 92, 231, .25), transparent);
    pointer-events: none;
}
.api-hero-inner {
    position: relative;
    z-index: 1;
}
.api-hero-badge {
    display: inline-block;
    padding: .3rem .9rem;
    border-radius: 999px;
    background: rgba(108, 92, 231, .15);
    border: 1px solid rgba(108, 92, 231, .4);
    color: var(--cxp-accent-2);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 1rem;
}
.api-hero h1 {
    color: #fff;
    font-weight: 700;
    font-size: 2.1rem;
    margin-bottom: .6rem;
}
.api-hero p {
    color: #9ca3af;
    max-width: 560px;
    margin: 0 auto 1.5rem;
}
.api-hero-baseurl {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    background: rgba(15, 17, 30, .6);
    border: 1px solid rgba(108, 92, 231, .3);
    border-radius: 999px;
    padding: .55rem 1.3rem;
    max-width: 100%;
}
.api-hero-baseurl span {
    color: #9ca3af;
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .8px;
    white-space: nowrap;
}
.api-hero-baseurl code {
    color: var(--cxp-accent-2);
    background: none;
    padding: 0;
    font-size: .88rem;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .api-navbar-toggle {
        display: flex;
    }
    .api-navbar-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgb(15, 17, 30);
        border-bottom: 1px solid rgba(108, 92, 231, .2);
        padding: .5rem 1.5rem;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
    }
    .api-navbar-links.open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        transition: opacity .2s ease, transform .2s ease;
    }
    .api-nav-link {
        padding: .75rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, .06);
    }
    .api-nav-link::after {
        display: none;
    }
    .api-nav-cta {
        margin: .75rem 0;
        text-align: center;
    }
    .api-hero h1 {
        font-size: 1.6rem;
    }
}

/* Offset anchored sections so the sticky navbar doesn't cover
   their heading when jumping to #wallet, #status, etc. */
.api-section {
    scroll-margin-top: 90px;
}

/* Custom styles */
.api-section {
    margin-bottom: 2rem;
    width: 100%;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Top-level section cards (Introduction, Wallet/Pool/Block/Currency
   Endpoints) — dark glass card matching explorer/wallet theme. */
.api-section.card {
    border: 1px solid rgba(108, 92, 231, .18) !important;
    border-radius: var(--cxp-radius) !important;
    background: rgba(23, 26, 43, .85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, .3);
    overflow: hidden;
}
.api-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 55px rgba(108, 92, 231, .22);
}
.api-section > .card-header {
    cursor: default;
    background: var(--cxp-accent-gradient);
    border: 0;
    color: #fff;
}
.api-section > .card-header .card-title {
    color: #fff;
    font-weight: 700;
}
.api-section .card-body {
    color: #e5e7eb;
}
.api-section .card-body p {
    color: #c9ccdb;
}
.api-section .card-body code {
    color: var(--cxp-accent-2);
    background: rgba(0, 217, 192, .1);
    padding: .15rem .4rem;
    border-radius: 6px;
}

/* Nested accordion cards (request/response toggles) — subtler,
   still dark-glass but distinct from the top-level section card. */
.api-section .accordion .card {
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(108, 92, 231, .14) !important;
    border-radius: 10px !important;
    margin-bottom: 10px;
    overflow: hidden;
}
.api-section .accordion .card-header {
    cursor: pointer;
    background: rgba(108, 92, 231, .1);
    color: #e5e7eb;
    transition: background-color 0.2s ease;
    border: 0;
}
.api-section .accordion .card-header:hover {
    background-color: rgba(108, 92, 231, .18);
}

.api-code {
    background-color: rgba(15, 17, 30, .7);
    color: #f8f9fa;
    border: 1px solid rgba(108, 92, 231, .2);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95em;
    position: relative;
    word-wrap: break-word;
}
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--cxp-accent-gradient);
    color: #fff;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    transition: filter 0.2s ease;
}
.copy-btn:hover {
    filter: brightness(1.12);
}
body:not(.sidebar-mini-md):not(.sidebar-mini-xs):not(.layout-top-nav) .content-wrapper,
/* This page has no sidebar, so AdminLTE's usual sidebar-margin
   injection on .main-footer is just noise — pin it to the same
   -15px the navbar/hero use to go edge-to-edge instead of the
   0 this override used to force. */
body:not(.sidebar-mini-md):not(.sidebar-mini-xs):not(.layout-top-nav) .main-footer {
    margin-left: -15px !important;
}
.content-wrapper {
    padding: 0 15px;
}
/* Sticky footer: on a short page (e.g. the wallet form, with barely
   more than a search bar), .content growing to fill the leftover
   viewport height pushes the footer that follows it down to the
   bottom instead of it floating right under the content.
   ".wrapper .content-wrapper" matches AdminLTE's own selector
   specificity (its calc()-based min-height otherwise wins over a
   plain ".content-wrapper" rule despite loading first). */
.wrapper .content-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.content-wrapper > .content {
    flex: 1 0 auto;
}
.main-footer {
    background: rgba(23, 26, 43, .9);
    color: #c9ccdb;
    margin-top: 3rem;
    margin-right: -15px;
    padding: 0;
    border-top: 1px solid rgba(108, 92, 231, .2);
}
.main-footer a {
    color: var(--cxp-accent-2);
    transition: color 0.2s ease;
}
.main-footer a:hover {
    color: #6C5CE7;
    text-decoration: underline;
}

/* ============================================================
   FOOTER (richer, multi-column layout)
   ============================================================ */
.api-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.4rem 1.5rem 1.8rem;
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr;
    gap: 2rem;
}
.api-footer-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .7rem;
}
.api-footer-brand img {
    height: 36px;
    width: 36px;
    object-fit: contain;
    border-radius: 8px;
}
.api-footer-brand p {
    color: #9ca3af;
    font-size: .85rem;
    max-width: 300px;
    margin: 0;
}
.api-footer-col h6 {
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .6px;
    font-size: .72rem;
    font-weight: 700;
    margin-bottom: .9rem;
}
.api-footer-col a {
    display: block;
    color: #9ca3af;
    text-decoration: none;
    font-size: .9rem;
    margin-bottom: .6rem;
    transition: color .2s ease;
}
.api-footer-col a:hover {
    color: var(--cxp-accent-2);
    text-decoration: none;
}
.api-footer-bottom {
    border-top: 1px solid rgba(108, 92, 231, .15);
    padding: 1.1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    font-size: .82rem;
    color: #9ca3af;
}
@media (max-width: 768px) {
    .api-footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.8rem;
    }
    .api-footer-brand {
        align-items: center;
    }
    .api-footer-brand p {
        max-width: 100%;
        margin: 0 auto;
    }
    .api-footer-bottom {
        justify-content: center;
        text-align: center;
    }
}
.container-fluid {
    padding: 0 15px;
}
.btn-link {
    color: var(--cxp-accent-2) !important;
    text-decoration: none;
    font-weight: 500;
}
.btn-link:hover {
    color: #fff !important;
    text-decoration: underline;
}
.btn-link.collapsed {
    color: var(--cxp-accent-2) !important;
}
a {
    color: var(--cxp-accent-2);
    transition: color 0.2s ease;
}
a:hover {
    color: #6C5CE7;
    text-decoration: underline;
}
/* Notification pour la copie */
#copy-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 17, 30, .95);
    border: 1px solid rgba(108, 92, 231, .35);
    color: #ffffff;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 16px;
    font-family: Arial, Helvetica, sans-serif;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    z-index: 10000;
    pointer-events: none;
    min-width: 200px;
    text-align: center;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .4);
}
#copy-notification.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}
#copy-notification.hide {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
}
/* Bouton Try It */
.try-btn {
    background: linear-gradient(135deg, #00B8D9, #00D9C0);
    color: #0f1120;
    font-weight: 700;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    margin-top: 0.5rem;
    transition: filter 0.2s ease;
}
.try-btn:hover {
    filter: brightness(1.1);
}
.try-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    filter: none;
}
.try-input-group {
    margin-bottom: .5rem;
}
.try-input {
    width: 100%;
    max-width: 320px;
    background: rgba(15, 17, 30, .7);
    border: 1px solid rgba(108, 92, 231, .3);
    border-radius: 8px;
    color: #fff;
    padding: .4rem .7rem;
    font-family: 'Courier New', Courier, monospace;
}
.try-input:focus {
    outline: none;
    border-color: var(--cxp-accent);
    background: rgba(15, 17, 30, .9);
}
.try-input::placeholder {
    color: rgba(255, 255, 255, .4);
}
.try-result {
    display: none;
    margin: .6rem 0 0;
    background-color: rgba(15, 17, 30, .7);
    color: #f8f9fa;
    border: 1px solid rgba(108, 92, 231, .2);
    border-radius: 8px;
    padding: .75rem 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    word-break: break-word;
}
.try-result.try-result-error {
    border-color: rgba(239, 68, 68, .5);
    color: #fca5a5;
}
/* Media queries pour responsivité */
@media (max-width: 576px) {
    .api-section {
        padding: 0 10px;
    }
    .api-code {
        font-size: 0.85em;
    }
    .card-header h3, .card-header h5 {
        font-size: 1rem;
    }
    .copy-btn {
        top: 0.3rem;
        right: 0.3rem;
        padding: 0.2rem 0.4rem;
        font-size: 0.9em;
    }
}
@media (min-width: 1200px) {
    .api-section {
        max-width: 1200px;
    }
}

/* ============================================================
   DATA PAGES (/status, /currencies, /currencies/{symbol}, /blocks,
   /wallet) — the live human-readable views rendered directly from
   App\Controllers\Api\{Status,Currencies,Blocks}. Reuse the same
   card language as .api-section above, in a responsive grid instead
   of a single stacked column since these can render many cards.
   ============================================================ */
.api-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.4rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px 3rem;
}
.api-data-grid.api-data-grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
}
.api-data-card {
    border: 1px solid rgba(108, 92, 231, .18);
    border-radius: var(--cxp-radius);
    background: rgba(23, 26, 43, .85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.api-data-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 55px rgba(108, 92, 231, .22);
}
.api-data-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: 14px 20px;
    background: var(--cxp-accent-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
}
.api-data-card-header .algo-pill {
    background: rgba(0, 0, 0, .2);
    padding: .2rem .7rem;
    border-radius: 999px;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
}
.api-data-card-body {
    padding: 4px 0;
}
.api-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.api-data-table tr {
    border-bottom: 1px solid rgba(108, 92, 231, .12);
}
.api-data-table tr:last-child {
    border-bottom: 0;
}
.api-data-table th,
.api-data-table td {
    padding: 9px 20px;
    text-align: left;
    vertical-align: middle;
}
.api-data-table th {
    color: #9ca3af;
    font-weight: 600;
    width: 46%;
}
.api-data-table td {
    color: #e5e7eb;
    font-family: 'Courier New', Courier, monospace;
}
.api-data-table td.mono {
    font-family: 'Courier New', Courier, monospace;
}
.api-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.api-status-dot.on {
    background: #00D9C0;
    box-shadow: 0 0 8px rgba(0, 217, 192, .7);
}
.api-status-dot.off {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, .7);
}
.api-empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 4rem 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}
.api-empty-state i {
    font-size: 2.4rem;
    color: rgba(108, 92, 231, .5);
    margin-bottom: 1rem;
    display: block;
}

/* Blocks table — full-width card per coin instead of the metric-grid
   card above, since each row is a block rather than a key/value pair. */
.api-blocks-card {
    border: 1px solid rgba(108, 92, 231, .18);
    border-radius: var(--cxp-radius);
    background: rgba(23, 26, 43, .85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto 1.6rem;
}
.api-blocks-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--cxp-accent-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}
.api-blocks-card-header span {
    font-size: .75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .85);
}
.api-blocks-table-wrap {
    overflow-x: auto;
}
.api-blocks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    white-space: nowrap;
}
.api-blocks-table th,
.api-blocks-table td {
    padding: 10px 16px;
    text-align: left;
}
.api-blocks-table thead th {
    background: rgba(108, 92, 231, .14);
    color: #fff;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    position: sticky;
    top: 0;
}
.api-blocks-table tbody tr {
    border-bottom: 1px solid rgba(108, 92, 231, .1);
}
.api-blocks-table tbody tr:hover {
    background: rgba(108, 92, 231, .07);
}
.api-blocks-table td {
    color: #e5e7eb;
}
.api-blocks-table td.mono {
    font-family: 'Courier New', Courier, monospace;
    color: #9ca3af;
}
.api-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.api-badge.generate {
    background: rgba(0, 217, 192, .15);
    color: #00D9C0;
    border: 1px solid rgba(0, 217, 192, .35);
}
.api-badge.immature {
    background: rgba(245, 158, 11, .15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, .35);
}
.api-badge.orphan,
.api-badge.kicked {
    background: rgba(239, 68, 68, .15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, .35);
}

/* Wallet lookup form (shown when no ?address= is given) */
.api-wallet-form {
    max-width: 500px;
    margin: 0 auto 2rem;
    padding: 0 15px;
    display: flex;
    gap: 0;
}
.api-wallet-form input {
    flex: 1;
    background: rgba(15, 17, 30, .7);
    border: 1px solid rgba(108, 92, 231, .3);
    border-radius: 999px 0 0 999px;
    color: #fff;
    padding: .7rem 1.2rem;
    font-family: 'Courier New', Courier, monospace;
}
.api-wallet-form input:focus {
    outline: none;
    border-color: var(--cxp-accent);
}
.api-wallet-form input::placeholder {
    color: rgba(255, 255, 255, .4);
}
.api-wallet-form button {
    background: var(--cxp-accent-gradient);
    border: none;
    border-radius: 0 999px 999px 0;
    color: #fff;
    font-weight: 700;
    padding: .7rem 1.6rem;
}

@media (max-width: 576px) {
    .api-data-grid,
    .api-data-grid.api-data-grid-wide {
        grid-template-columns: 1fr;
    }
}
