/* ============================================
   SECRETOBANK - Global Stylesheet
   Web3 Modern Design System
   ============================================ */

/* Google Fonts - Inter for clean modern look */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---- CSS Variables / Light Mode (default) ---- */
:root {
    /* Core palette */
    --bg-primary: #faf9fe;
    --bg-gradient: linear-gradient(135deg, #fce4ec 0%, #e8eaf6 30%, #e0f7fa 60%, #fff3e0 100%);
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-solid: #ffffff;
    --bg-input: #ffffff;
    --bg-table-header: #f1f0fb;
    --bg-table-alt: #f8f7fd;

    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #555770;
    --text-muted: #8b8ca7;
    --text-on-dark-btn: #ffffff;

    /* Accent */
    --accent-primary: #1a1a2e;
    --accent-hover: #2d2d4a;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;

    /* Borders & Shadows */
    --border-color: #e2e2f0;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-pill: 50px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);

    /* Links */
    --link-color: #1a1a2e;
    --footer-link-color: #555770;

    /* Volume specific */
    --volume-color: #3b82f6;

    /* Table rows */
    --tr-row-alt: #f8f7fd;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-med: 0.3s ease;
}

/* ---- Dark Mode ---- */
.dark-mode {
    --bg-primary: #13132b;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --bg-card: rgba(30, 30, 60, 0.85);
    --bg-card-solid: #1e1e3c;
    --bg-input: #252548;
    --bg-table-header: #252548;
    --bg-table-alt: #1e1e3c;

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0c0;
    --text-muted: #6b6b8d;
    --text-on-dark-btn: #1a1a2e;

    --accent-primary: #e8e8f0;
    --accent-hover: #ffffff;
    --accent-blue: #60a5fa;
    --accent-green: #34d399;
    --accent-red: #f87171;
    --accent-purple: #a78bfa;

    --border-color: #2e2e50;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);

    --link-color: #a0a0c0;
    --footer-link-color: #a0a0c0;
    --volume-color: #60a5fa;
    --tr-row-alt: #1e1e3c;
}

/* ---- Base Reset & Typography ---- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    text-align: center;
    transition: background var(--transition-med), color var(--transition-med);
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-blue);
}

h1, h2, h3, h4 {
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0;
}

h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---- Navigation ---- */
.site-nav {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.site-nav .nav-brand {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.site-nav .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.site-nav .nav-links a {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--border-radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.site-nav .nav-links a:hover,
.site-nav .nav-links a.active {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.site-nav .nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-dark-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-pill);
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.btn-dark-toggle:hover {
    background: var(--bg-card);
    border-color: var(--text-primary);
    color: var(--text-primary);
    transform: none;
}

/* ---- Main Content Wrapper ---- */
#app,
.page-content {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 20px 40px;
    text-align: center;
}

/* ---- Card / Container ---- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.container {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    max-width: 1200px;
    margin: 0 auto 20px;
}

/* ---- Buttons ---- */
button,
input[type="submit"] {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius-pill);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary,
input[type="submit"] {
    background: var(--accent-primary);
    color: var(--text-on-dark-btn);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
input[type="submit"]:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    background: var(--bg-card);
}

button {
    background: var(--accent-primary);
    color: var(--text-on-dark-btn);
    margin: 5px;
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* ---- Form Inputs ---- */
input[type="text"],
input[type="number"],
textarea,
select {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea {
    resize: vertical;
}

/* ---- Tables ---- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    background: var(--bg-table-header);
    color: var(--text-primary);
    font-weight: 600;
    padding: 10px 8px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    cursor: pointer;
}

th:hover {
    background: var(--border-color);
}

td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

tr:nth-child(even) {
    background-color: var(--tr-row-alt);
}

/* ---- Flex Table Rows (code/dai/single sections) ---- */
.balance-table {
    display: table;
    width: 100%;
    margin-bottom: 20px;
}

.table-header, .table-row {
    display: table-row;
}

.table-header span, .table-row span {
    display: table-cell;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

.table-header {
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
}

.table-row span:first-child {
    text-align: left;
}

.table-row span:last-child {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.table-row {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.balance-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.balance-total {
    font-family: 'Courier New', monospace;
}

.total-balance {
    margin-left: 10px;
    font-weight: normal;
}

/* ---- Token Info Rows (code section) ---- */
.address-group {
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.token-info-header, .token-info {
    display: flex;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.token-info-header {
    background: var(--bg-table-header);
    font-weight: 600;
}

.token-info-header span, .token-info span {
    flex-grow: 1;
    text-align: right;
}

.token-info-header span:first-child, .token-info span:first-child {
    text-align: left;
}

.token-info-header span:nth-child(1), .token-info span:nth-child(1) { flex-basis: 25%; }
.token-info-header span:nth-child(2), .token-info span:nth-child(2) { flex-basis: 25%; }
.token-info-header span:nth-child(3), .token-info span:nth-child(3) { flex-basis: 20%; }
.token-info-header span:nth-child(4), .token-info span:nth-child(4) { flex-basis: 15%; }
.token-info-header span:nth-child(5), .token-info span:nth-child(5) { flex-basis: 15%; }

.token-info {
    background: var(--bg-card);
}

.total-value {
    padding: 10px;
    background: var(--bg-table-header);
    border-top: 1px solid var(--border-color);
    text-align: right;
    font-weight: 700;
}

#grand-total-value {
    text-align: center;
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg-table-header);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

/* ---- Volume-specific ---- */
.volume {
    color: var(--volume-color);
    font-weight: 600;
}

.total-volume, .total-liquidity, .total-tokens {
    font-weight: 700;
    margin-top: 16px;
    text-align: center;
    font-size: 1.5em;
}

.pairs { font-size: 0.75em; }
.dexid { font-size: 0.75em; }
.liquidity { font-size: 0.9em; }
.token-in-lp { font-size: 0.65em; }
.token-in-lp span { color: var(--accent-red); }

/* ---- Loading Spinner ---- */
.spinner {
    border: 4px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--accent-blue);
    animation: spin 1s ease infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---- Loading Bar ---- */
#loadingBarContainer {
    width: 100%;
    background: var(--border-color);
    border-radius: var(--border-radius-pill);
    display: none;
    overflow: hidden;
}

#loadingBar {
    height: 6px;
    width: 0%;
    background: var(--accent-blue);
    border-radius: var(--border-radius-pill);
    animation: glowAndDim 2s ease-in-out infinite;
}

@keyframes glowAndDim {
    0%, 100% { opacity: 0.5; width: 0%; }
    50% { opacity: 1; width: 100%; }
}

/* ---- Footer ---- */
.footer {
    max-width: 920px;
    margin: 20px auto;
    padding: 16px 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--footer-link-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.footer a:hover {
    color: var(--accent-blue);
}

/* ---- Zero value toggle ---- */
.zero-value {
    display: none;
}

.red { color: var(--accent-red); }

/* ---- Misc helpers ---- */
span.numnum { font-size: 0.7em; }
span.price { font-size: 0.7em; }
span.symbolname { font-size: 0.8em; }
span.holders { color: var(--accent-purple); font-weight: bold; }

.smaller-and-raised {
    font-size: 0.8em;
    position: relative;
    top: -0.2em;
}

#toggleZeroValue { float: right; }
div.clear { clear: both; }

.hideme { /* for legacy dark mode button class - now replaced */ }

/* ---- Highcharts overrides ---- */
.highcharts-container {
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .site-nav {
        flex-direction: column;
        text-align: center;
    }

    .site-nav .nav-links {
        justify-content: center;
    }

    #app, .page-content {
        padding: 0 12px 30px;
    }

    h1 { font-size: 1.4rem; }

    .card, .container {
        padding: 16px;
        border-radius: var(--border-radius-md);
    }

    input[type="text"],
    textarea {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .site-nav .nav-links a {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}
