/* Kikiriki Cyber-Terminal Theme */

:root {
    --bg-base: #000000;
    --bg-panel: #080808;
    --border-main: #1a1a1a;
    --text-primary: #e0e0e0; /* Improved contrast */
    --text-muted: #888888;   /* Improved legibility */
    --cyan: #00f0ff;
    --amber: #ffaa00;
    --font-ui: 'Manrope', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #222 var(--bg-base);
}

html, body {
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Modern mobile browsers: accounts for address bar */
    margin: 0;
    padding: 0;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 16px;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Rigid Layout Structure */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

/* Custom Industrial Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: #222;
    border: 1px solid var(--border-main);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-main);
    border-color: var(--text-muted);
}

.k-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* Mobile Z-index fix for dropdown over map */
.dropdown-menu {
    z-index: 1030 !important; /* Ensure dropdowns stay above map controls (1000) */
}

.k-header {
    height: 70px; /* Reduced from 80px */
    border-bottom: 1px solid var(--border-main);
    display: flex;
    align-items: center;
    padding: 0 20px;
    flex-shrink: 0;
    background: var(--bg-panel);
    position: relative;
    z-index: 1020; /* Above map and standard UI elements */
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    .k-header {
        padding: 0 10px;
        height: auto;
        min-height: 60px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .k-header img[alt="Logo"] {
        height: 50px !important;
    }
    .k-main {
        padding: 0;
    }
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    .tiny-text {
        font-size: 0.75rem;
    }
    .small {
        font-size: 0.8rem;
    }
    .dropdown-menu {
        max-width: 90vw;
    }
    .display-6 {
        font-size: 1.4rem;
    }
    h1.display-6 {
        font-size: 1.2rem;
    }
}

.k-main {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    -webkit-overflow-scrolling: touch; /* Smooth scroll on older iOS */
}

/* Typography & Colors */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); font-weight: 700; }
.small { font-size: 0.85rem; }
.tiny-text { font-size: 0.75rem; letter-spacing: 0.5px; }
.data-font { font-family: var(--font-mono); letter-spacing: -0.3px; }

/* Placeholder Legibility */
::placeholder {
    color: #aaaaaa !important;
    opacity: 1 !important;
}

.bg-panel { background: var(--bg-panel); }
.text-muted { color: var(--text-muted) !important; }
.text-cyan { color: var(--cyan) !important; }
.text-amber { color: var(--amber) !important; }
.text-success-industrial { color: var(--cyan); } /* Unified with cyan */

/* Common Components */
.card-kikiriki {
    background: var(--bg-panel);
    border: 1px solid var(--border-main);
    padding: 15px;
    border-radius: 0 !important;
}

.card-kikiriki:hover {
    border-color: #333;
}

/* Buttons */
.btn-xs {
    padding: 1px 5px;
    font-size: 9px;
    line-height: 1.5;
}

/* Centering Logic */
.k-absolute-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Dropdown Custom */
.dropdown-menu-dark {
    background-color: var(--bg-panel) !important;
    border: 1px solid var(--border-main) !important;
    border-radius: 0 !important;
    font-size: 12px;
}

/* Accentuated Modal Blur */
.modal-backdrop.show {
    opacity: 0.8;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    box-shadow: none;
    border: 1px solid var(--border-main);
}

/* Exchange Table Style (interface_example.png) */
.table-kikiriki {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table-kikiriki thead th {
    background-color: #000;
    border-bottom: 1px solid var(--border-main);
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    padding: 12px 15px;
    font-weight: 600;
}

.table-kikiriki tbody tr {
    border-bottom: 1px solid #111;
    transition: background 0.2s;
}

.table-kikiriki tbody tr:hover {
    background-color: #0a0a0a;
}

.table-kikiriki td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-main);
}

/* Mobile override for table-kikiriki (must be after general rules for specificity) */
@media (max-width: 768px) {
    .table-kikiriki thead th {
        padding: 8px 6px;
        font-size: 0.65rem;
    }
    .table-kikiriki thead th:first-child {
        width: 40px !important;
    }
    .table-kikiriki td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    .table-kikiriki td:first-child {
        width: 40px !important;
        padding-right: 2px;
    }
    .table-kikiriki td a.fs-4,
    .table-kikiriki td a.fs-5 {
        font-size: 0.85rem !important;
    }
    .table-kikiriki thead th:nth-child(3),
    .table-kikiriki td:nth-child(3) {
        width: 1%;
        white-space: nowrap;
    }
}

.sparkline-container {
    width: 100px;
    height: 30px;
}

/* Ranking Highlights */
.row-rank-1 { background: rgba(255, 215, 0, 0.05) !important; border-left: 2px solid #ffd700 !important; }
.row-rank-2 { background: rgba(192, 192, 192, 0.05) !important; border-left: 2px solid #c0c0c0 !important; }
.row-rank-3 { background: rgba(205, 127, 50, 0.05) !important; border-left: 2px solid #cd7f32 !important; }

.text-gold { color: #ffd700 !important; }
.text-silver { color: #c0c0c0 !important; }
.text-bronze { color: #cd7f32 !important; }

/* how-it-works & dashboard components */
.card-kikiriki-flat { background: #080808; border: 1px solid #333; }
.bg-panel-light { background: rgba(0, 255, 255, 0.03); border: 1px solid #1a1a1a; }
/* Interactive Elements */
.hover-cyan:hover { color: var(--cyan) !important; }
.hover-cyan-border { will-change: transform; }
.hover-cyan-border:hover { border-color: var(--cyan) !important; box-shadow: 0 0 10px rgba(0, 240, 255, 0.3); transform: scale(1.1); z-index: 10; position: relative; }

/* Dashboard Map Popup */
.custom-dark-popup .leaflet-popup-content-wrapper {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.15);
}
.custom-dark-popup .leaflet-popup-content {
    margin: 0;
    line-height: inherit;
}
.custom-dark-popup .leaflet-popup-tip-container {
    display: none;
}
.custom-dark-popup a.leaflet-popup-close-button {
    color: #fff !important;
    top: 6px !important;
    right: 6px !important;
    padding: 0 !important;
    font-size: 16px !important;
}
.custom-dark-popup a.leaflet-popup-close-button:hover {
    color: var(--cyan) !important;
    background: transparent !important;
}
.dashboard-map-popup .sparkline-container {
    border-radius: 0;
}

/* Mobile Filter Bar Adjustments */
@media (max-width: 768px) {
    .btn-sector-selector {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
    #asset-search {
        height: 45px;
    }
}

/* Utility: Hover & Accent Classes */
.hover-bg-dark:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.bg-dark-cyan {
    background-color: rgba(0, 240, 255, 0.15) !important;
}


