/* ===========================================
   AI Lightning - Web Client Styles
   =========================================== */

:root {
    --primary: #fdb499;
    --primary-dark: #e55a2b;
    --secondary: #94c5f9;
    --background: #1a1a2e;
    --surface: #2d2d44;
    --surface-light: #3a3a52;
    --text: #e0e0e0;
    --text-muted: #888;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #16213e 100%);
    color: var(--text);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* ===========================================
   Header
   =========================================== */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--surface-light);
}

.header-main h1 {
    font-size: 2.5em;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header .tagline {
    color: var(--text-muted);
    margin: 5px 0 15px;
}

.header-nav {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin: 15px 0;
}

.header-nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95em;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
}

.header-nav a:hover {
    background: var(--surface);
    color: var(--primary);
}

#network-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--error);
    transition: background 0.3s;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* ===========================================
   Auth Section
   =========================================== */
#auth-section {
    max-width: 400px;
    margin: 0 auto;
}

.auth-form {
    background: var(--surface);
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
}

.auth-form h2 {
    margin-top: 0;
    color: var(--primary);
}

.auth-form input {
    width: 100%;
    padding: 12px 15px;
    margin: 10px 0;
    border: none;
    border-radius: 8px;
    background: var(--surface-light);
    color: var(--text);
    font-size: 1em;
}

.auth-form input:focus {
    outline: 2px solid var(--primary);
}

.auth-form button {
    width: 100%;
    margin-top: 15px;
}

.auth-form p {
    margin-top: 20px;
    color: var(--text-muted);
}

.auth-form .form-hint {
    margin: 10px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.auth-form a {
    color: var(--primary);
    text-decoration: none;
}

.auth-form a:hover {
    text-decoration: underline;
}

/* Email verification error message */
.error-message {
    background: var(--surface);
    border: 1px solid var(--error);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
}

.error-message p {
    margin: 5px 0;
    color: var(--text);
}

.error-message .btn-secondary {
    background: var(--primary);
    color: var(--background);
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
}

.error-message .btn-secondary:hover {
    background: var(--primary-light);
}

/* ===========================================
   Main Section
   =========================================== */
#user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.user-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

#user-info {
    color: var(--text-muted);
}

/* Balance Display */
.balance-display {
    background: var(--surface-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.3s;
}

.balance-display.low {
    color: var(--error);
    background: rgba(244, 67, 54, 0.15);
}

.balance-display.ok {
    color: var(--warning);
    background: rgba(255, 152, 0, 0.15);
}

.balance-display.good {
    color: var(--success);
    background: rgba(76, 175, 80, 0.15);
}

.btn-balance {
    padding: 6px 10px !important;
    font-size: 0.85em !important;
    background: var(--surface-light) !important;
}

.btn-balance:hover {
    background: var(--secondary) !important;
}

/* ===========================================
   Buttons
   =========================================== */
button {
    background: var(--primary);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.2s;
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

.btn-primary {
    background: var(--primary);
}

.btn-secondary {
    background: var(--surface-light);
}

.btn-secondary:hover {
    background: #4a4a62;
}

.btn-danger {
    background: var(--error);
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-stop {
    background: var(--warning);
    color: #1a1a2e;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95em;
    transition: all 0.3s;
    margin-left: 10px;
}

.btn-stop:hover {
    background: #ff7b00;
    transform: scale(1.05);
}

.btn-stop:active {
    transform: scale(0.95);
}

.btn-refresh {
    background: var(--surface-light);
    margin-top: 15px;
}

.btn-back {
    background: transparent;
    border: 1px solid var(--surface-light);
    color: var(--text-muted);
    padding: 8px 16px;
    margin-bottom: 15px;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.3s;
}

.btn-back:hover {
    background: var(--surface);
    color: var(--text);
}

.section-subtitle {
    color: var(--text-muted);
    margin-top: -5px;
    margin-bottom: 20px;
    font-size: 0.95em;
}

/* ===========================================
   Nodes Section
   =========================================== */
#nodes-section h3,
#models-section h3,
#session-config h3,
#invoice-section h3,
#network-panel h3 {
    color: var(--primary);
    margin-top: 0;
}

#nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.node-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.node-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.node-card.node-busy {
    opacity: 0.6;
    cursor: not-allowed;
}

.node-card.node-busy:hover {
    border-color: transparent;
    transform: none;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.node-name {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--text);
}

.node-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

.node-status.available {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.node-status.busy {
    background: rgba(244, 67, 54, 0.2);
    color: var(--error);
}

/* Restricted node badge */
.node-restricted-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: bold;
    background: rgba(156, 39, 176, 0.2);
    color: #9b59b6;
    margin-left: 8px;
}

/* Node version badge */
.node-version-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: bold;
    background: rgba(0, 188, 212, 0.2);
    color: #00bcd4;
    margin-left: auto;
}

.node-card.node-restricted {
    border-color: rgba(156, 39, 176, 0.4);
}

/* Disabled HuggingFace input for restricted nodes */
.huggingface-input.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.huggingface-input.disabled input,
.huggingface-input.disabled button {
    cursor: not-allowed;
}

.node-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.15));
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.node-price-icon {
    font-size: 1.2em;
}

.node-price-value {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--warning);
}

.node-specs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-size: 0.85em;
    color: var(--text-muted);
}

.node-spec {
    display: flex;
    align-items: center;
    gap: 6px;
}

.node-spec-icon {
    font-size: 1.1em;
}

.node-disk-bar {
    margin-top: 12px;
    background: var(--surface-light);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.node-disk-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.node-disk-fill.warning {
    background: var(--warning);
}

.node-disk-fill.danger {
    background: var(--error);
}

.node-disk-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 4px;
}

.node-models-count {
    margin-top: 10px;
    font-size: 0.9em;
    color: var(--secondary);
}

.node-busy-timer {
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--warning);
}

/* ===========================================
   HuggingFace Custom Model Section
   =========================================== */
.hf-custom-section {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px dashed var(--surface-light);
}

.hf-custom-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--secondary);
}

.hf-input-row {
    display: flex;
    gap: 10px;
}

.hf-input-row input {
    flex: 1;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 0.95em;
}

.hf-input-row input:focus {
    outline: none;
    border-color: var(--primary);
}

.hf-hint {
    margin-top: 8px;
    margin-bottom: 0;
    font-size: 0.8em;
    color: var(--text-muted);
}

/* ===========================================
   Models Section
   =========================================== */

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.no-models {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: var(--border-radius);
}

#models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.model-card {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    min-height: 180px;
    overflow: hidden;
}

.model-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.model-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.model-name {
    font-weight: 400;
    font-size: 0.95em;
    margin-bottom: 10px;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

.model-info {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.model-info .param {
    background: var(--secondary);
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 400;
}

.model-info .quant {
    background: var(--surface-light);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 400;
}

.model-specs {
    font-size: 0.8em;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    font-weight: 400;
}

.model-availability {
    margin-top: auto;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.badge-green {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.badge-yellow {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning);
}

/* ===========================================
   Model Card - Busy State
   =========================================== */
.model-card.model-busy {
    position: relative;
    opacity: 0.6;
    filter: grayscale(70%);
    border: 2px solid var(--surface-light);
    pointer-events: none;
}

.model-card.model-busy:hover {
    transform: none;
    border-color: var(--surface-light);
    box-shadow: none;
}

/* ===========================================
   Model Card - Disabled (Restricted)
   =========================================== */
.model-card.model-disabled {
    position: relative;
    opacity: 0.5;
    filter: grayscale(50%);
    border: 2px dashed var(--surface-light);
    cursor: not-allowed;
}

.model-card.model-disabled:hover {
    transform: none;
    border-color: var(--error);
    box-shadow: none;
}

.model-restricted-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--error);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
}

.model-busy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.model-busy-overlay .busy-icon {
    font-size: 2em;
    animation: pulse 2s infinite;
}

.model-busy-overlay .busy-text {
    font-weight: 600;
    color: var(--warning);
    font-size: 1.1em;
}

.model-busy-overlay .busy-timer {
    background: var(--surface);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    color: var(--text);
    font-family: 'Courier New', monospace;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===========================================
   Session Config
   =========================================== */
#session-config {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--surface-light);
}

.config-row:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
}

.config-row label {
    color: var(--text-muted);
}

/* Node Price Display in Session Config */
.node-price-row .node-price-value {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.15));
    border: 1px solid rgba(255, 193, 7, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
    color: var(--warning);
}

/* Context Slider */
.context-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.context-row label {
    margin-bottom: 5px;
}

.context-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.context-slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--surface-light);
    appearance: none;
    cursor: pointer;
}

.context-slider-container input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.2s;
}

.context-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.context-slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.slider-value {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
    font-family: 'Courier New', monospace;
    background: var(--surface-light);
    padding: 5px 10px;
    border-radius: 6px;
}

/* ===========================================
   Advanced LLM Parameters
   =========================================== */
.advanced-params {
    background: var(--surface-light);
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 20px 0;
}

.advanced-params summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--secondary);
    padding: 5px;
    outline: none;
}

.advanced-params summary:hover {
    color: var(--primary);
}

.advanced-params[open] summary {
    margin-bottom: 15px;
    border-bottom: 1px solid var(--surface);
    padding-bottom: 10px;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.param-group {
    background: var(--surface);
    padding: 15px;
    border-radius: 8px;
}

.param-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

.param-group input[type="range"] {
    width: calc(100% - 50px);
    margin-right: 10px;
    accent-color: var(--primary);
    vertical-align: middle;
}

.param-group input[type="number"] {
    width: 100%;
    padding: 8px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.95em;
}

.param-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
}

.param-value {
    display: inline-block;
    min-width: 40px;
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary);
}

.param-group small {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.8em;
    line-height: 1.4;
}

.config-row input {
    width: 100px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: var(--surface-light);
    color: var(--text);
    text-align: center;
}

.session-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.session-buttons button {
    margin: 0;
}

.btn-settings {
    background: var(--secondary);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-settings:hover {
    background: #3a7bc8;
    transform: translateY(-1px);
}

/* ===========================================
   LLM Settings Modal
   =========================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--surface-light);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--error);
    transform: none;
    background: transparent;
}

.modal-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--surface-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 25px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    color: var(--secondary);
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--surface-light);
    font-size: 1em;
}

/* Gear Button */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: 10px;
}

.btn-icon:hover {
    color: var(--primary);
    background: var(--surface-light);
    transform: rotate(30deg);
}

/* Full width param group */
.param-group.full-width {
    grid-column: 1 / -1;
}

.text-input-wide {
    width: 100%;
    padding: 10px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.text-input-wide:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===========================================
   RAG Panel Styles
   =========================================== */
.modal-small .modal-content {
    max-width: 500px;
}

.rag-description {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 20px;
    line-height: 1.5;
}

.rag-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--surface);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-light);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(24px);
}

.rag-topk-label {
    margin-left: auto;
    color: var(--text-muted);
}

.rag-toggle select {
    padding: 5px 10px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 4px;
    color: var(--text);
}

.rag-add-section {
    margin-bottom: 20px;
}

.rag-add-section h4,
.rag-documents-section h4 {
    color: var(--secondary);
    margin: 0 0 10px 0;
    font-size: 0.95em;
}

.rag-add-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.rag-status {
    color: var(--primary);
    font-size: 0.9em;
    min-height: 20px;
}

.rag-docs-list {
    background: var(--background);
    border-radius: var(--border-radius);
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
}

.rag-empty {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.9em;
    padding: 20px;
}

.rag-doc-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 8px;
}

.rag-doc-item:last-child {
    margin-bottom: 0;
}

.rag-doc-icon {
    font-size: 1.5em;
    margin-right: 10px;
}

.rag-doc-info {
    flex: 1;
}

.rag-doc-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.rag-doc-meta {
    font-size: 0.8em;
    color: var(--text-muted);
}

.rag-doc-remove {
    background: transparent;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.rag-doc-remove:hover {
    opacity: 1;
}

.rag-stats {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--surface-light);
}

#rag-text-content {
    width: 100%;
    padding: 10px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    resize: vertical;
}

#rag-text-content:focus {
    outline: none;
    border-color: var(--primary);
}

.text-input {
    width: 100%;
    padding: 10px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 6px;
    color: var(--text);
    margin-bottom: 15px;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.9em;
}

/* ===========================================
   Invoice Section
   =========================================== */
#invoice-section {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
}

/* QR Code Container */
#qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
}

#qr-code canvas,
#qr-code img {
    display: block;
    margin: 0 auto;
}

.qr-hint {
    text-align: center;
    color: var(--text-secondary);
    margin: 10px 0 15px 0;
    font-size: 0.9em;
}

/* Wallet Payment Option */
.wallet-pay-box {
    background: linear-gradient(135deg, var(--surface-light), var(--surface));
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.wallet-pay-box p {
    margin: 10px 0;
}

.wallet-pay-box .btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
    margin: 15px 0;
}

.or-divider {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: 15px !important;
}

.payment-auto-check {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9em;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

#invoice-container {
    position: relative;
    margin: 20px 0;
}

#invoice {
    background: var(--surface-light);
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Consolas', monospace;
    font-size: 0.8em;
    max-height: 100px;
    overflow-y: auto;
    text-align: left;
    margin-bottom: 10px;
}

.invoice-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.btn-lightning {
    background: linear-gradient(135deg, #f7931a, #ffb347) !important;
    color: #1a1a2e !important;
    font-weight: 600;
}

.btn-lightning:hover {
    background: linear-gradient(135deg, #ffb347, #f7931a) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(247, 147, 26, 0.4);
}

.invoice-amount {
    font-size: 1.3em;
    margin: 15px 0;
}

.invoice-amount span {
    color: var(--primary);
    font-weight: 600;
}

.invoice-hint {
    color: var(--text-muted);
    font-size: 0.9em;
    margin: 10px 0;
}

.payment-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}
}

/* ===========================================
   Chat Section
   =========================================== */
#session-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

#session-model {
    font-weight: 500;
}

#session-expires {
    color: var(--text-muted);
    font-size: 0.9em;
}

.chat-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.5;
}

.message.you {
    background: var(--surface-light);
    margin-left: 20%;
    border-bottom-right-radius: 4px;
}

.message.ai {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    margin-right: 20%;
    border-bottom-left-radius: 4px;
}

.message.system {
    background: transparent;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.9em;
    max-width: 100%;
    padding: 8px;
}

.message strong {
    display: block;
    margin-bottom: 5px;
    opacity: 0.8;
    font-size: 0.85em;
}

.input-area {
    display: flex;
    gap: 10px;
}

#prompt {
    flex-grow: 1;
    padding: 14px 18px;
    border: none;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 1em;
}

#prompt:focus {
    outline: 2px solid var(--primary);
}

#prompt:disabled {
    opacity: 0.5;
}

/* Typing indicator */
.message.loading {
    background: var(--surface-light);
    margin-right: 20%;
}

/* Streaming message cursor */
.message.streaming .cursor {
    display: inline-block;
    color: var(--primary);
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.message.streaming {
    border-left: 3px solid var(--primary);
}

.message.streaming .content {
    display: inline;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 5px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
}

/* Code formatting */
.message code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.message pre {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message pre code {
    background: none;
    padding: 0;
}

/* LaTeX/KaTeX styling */
.message .katex {
    font-size: 1.1em;
}

.message .katex-display {
    margin: 1em 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5em 0;
}

.message .katex-display > .katex {
    text-align: center;
}

.math-display {
    display: block;
    text-align: center;
    margin: 1em 0;
    padding: 0.5em;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow-x: auto;
}

.math-inline {
    display: inline;
}

.latex-error {
    color: var(--error);
    background: rgba(244, 67, 54, 0.1);
    padding: 2px 4px;
    border-radius: 2px;
}

/* ===========================================
   Network Panel
   =========================================== */
#network-panel {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
}

#network-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .label {
    font-size: 0.85em;
    color: var(--text-muted);
}

.info-item span:not(.label) {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--primary);
}

/* ===========================================
   Modal
   =========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h3 {
    margin-top: 0;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-muted);
}

.close:hover {
    color: var(--text);
}

.node-card {
    background: var(--surface-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.node-name {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 8px;
}

.node-info {
    font-size: 0.9em;
    color: var(--text-muted);
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.node-gpus {
    margin-bottom: 8px;
}

.gpu-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    background: var(--surface);
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.gpu-vram {
    color: var(--primary);
}

.node-models {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* ===========================================
   Notifications
   =========================================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s;
    z-index: 2000;
    max-width: 400px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    background: var(--success);
}

.notification.error {
    background: var(--error);
}

.notification.info {
    background: var(--secondary);
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    #models-grid {
        grid-template-columns: 1fr;
    }
    
    .message {
        max-width: 90%;
    }
    
    .message.you {
        margin-left: 10%;
    }
    
    .message.ai {
        margin-right: 10%;
    }
    
    #session-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #network-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .config-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ===========================================
   Loading Overlay
   =========================================== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    padding: 40px;
    background: var(--surface);
    border-radius: var(--border-radius);
    max-width: 400px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--surface-light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    font-size: 1.1em;
    color: var(--text);
    margin-bottom: 10px;
}

.loading-status {
    font-size: 0.95em;
    color: var(--primary);
    margin-bottom: 10px;
    min-height: 1.2em;
    word-break: break-word;
    max-width: 350px;
}

.loading-timer {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 20px;
}

.loading-content .btn {
    margin-top: 10px;
}
/* ===========================================
   Footer
   =========================================== */
#footer {
    background: var(--surface);
    margin-top: 60px;
    padding: 40px 20px 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

.footer-section h4 {
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.footer-section p {
    color: var(--text-muted);
    font-size: 0.9em;
    line-height: 1.6;
    margin: 0;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--surface-light);
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.85em;
    margin: 5px 0;
}

.footer-tagline {
    color: var(--text) !important;
    font-size: 0.9em !important;
}

/* ===========================================
   Info Modals (About, How it Works, etc.)
   =========================================== */
.modal-info {
    max-width: 600px;
}

.modal-info .modal-body {
    text-align: left;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-info h4 {
    color: var(--primary);
    margin-top: 25px;
    margin-bottom: 10px;
}

.modal-info p {
    line-height: 1.7;
    color: var(--text);
}

.modal-info ul, .modal-info ol {
    padding-left: 20px;
    margin: 10px 0;
}

.modal-info li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.modal-info a {
    color: var(--primary);
}

.modal-info a:hover {
    text-decoration: underline;
}

/* Contact Modal */
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 25px 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--surface-light);
    padding: 20px;
    border-radius: var(--border-radius);
}

.contact-icon {
    font-size: 2rem;
}

.contact-item strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.contact-item p {
    margin: 0;
    color: var(--text-secondary);
}

.contact-item a {
    color: var(--primary);
    text-decoration: none;
    font-size: 1.1rem;
}

.contact-item a:hover {
    text-decoration: underline;
}

.contact-note {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

/* How it Works Steps */
.steps {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.step {
    background: var(--surface-light);
    padding: 20px;
    border-radius: var(--border-radius);
    position: relative;
}

.step-num {
    position: absolute;
    top: -10px;
    left: 20px;
    background: var(--primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.step h4 {
    margin-top: 10px;
    margin-bottom: 8px;
}

.step p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95em;
}

/* CTA Box */
.cta-box {
    margin-top: 25px;
    text-align: center;
    padding: 20px;
    background: var(--surface-light);
    border-radius: var(--border-radius);
}

.cta-box .btn-primary {
    display: inline-block;
    padding: 12px 30px;
    font-size: 1em;
    text-decoration: none;
}

/* ===========================================
   Tab Navigation
   =========================================== */
.main-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--surface-light);
    padding-bottom: 5px;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1em;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--surface);
    color: var(--text);
}

.tab-btn.active {
    background: var(--surface);
    color: var(--primary);
    font-weight: bold;
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

/* ===========================================
   Wallet Styles
   =========================================== */
.wallet-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 30px;
}

.wallet-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--surface-light);
}

.wallet-header h3 {
    margin: 0 0 15px 0;
    font-size: 1.5em;
}

.wallet-balance-big {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
}

.wallet-balance-big .balance-amount {
    font-size: 3em;
    font-weight: bold;
    color: var(--primary);
}

.wallet-balance-big .balance-unit {
    font-size: 1.2em;
    color: var(--text-muted);
}

.wallet-balance-btc {
    color: var(--text-muted);
    margin-top: 5px;
}

.wallet-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.wallet-actions button {
    min-width: 150px;
    padding: 15px 30px;
    font-size: 1.1em;
}

.wallet-transactions {
    background: var(--surface-light);
    border-radius: var(--border-radius);
    padding: 20px;
}

.wallet-transactions h4 {
    margin: 0 0 15px 0;
}

#transactions-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--surface);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-info {
    flex: 1;
}

.transaction-type {
    font-weight: bold;
    text-transform: capitalize;
}

.transaction-type.deposit { color: var(--success); }
.transaction-type.session_payment { color: var(--error); }
.transaction-type.node_earning { color: var(--success); }
.transaction-type.commission { color: var(--warning); }
.transaction-type.refund { color: #9b59b6; } /* Purple for refunds */

.transaction-desc {
    font-size: 0.9em;
    color: var(--text-muted);
}

.transaction-amount {
    font-weight: bold;
    font-size: 1.1em;
}

.transaction-amount.positive { color: var(--success); }
.transaction-amount.negative { color: var(--error); }

.transaction-date {
    font-size: 0.8em;
    color: var(--text-muted);
}

/* Deposit Modal */
#deposit-modal .modal-content {
    max-width: 500px;
    width: 95%;
    margin: auto;
}

#deposit-modal .modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
}

#deposit-invoice {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#deposit-qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#deposit-qr-code canvas,
#deposit-qr-code img,
#deposit-qr-code svg {
    display: block;
    max-width: 100%;
    height: auto;
}

.invoice-text {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin: 15px auto;
}

.invoice-text input {
    flex: 1;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-family: 'Consolas', monospace;
    font-size: 0.8em;
}

.invoice-text .btn-copy {
    padding: 12px 15px;
    white-space: nowrap;
}

.deposit-amount-select {
    margin-bottom: 20px;
    width: 100%;
}

.amount-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.amount-btn {
    padding: 12px;
    background: var(--surface-light);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.amount-btn:hover {
    border-color: var(--primary);
}

.amount-btn.active {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.1);
}

.custom-amount {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.custom-amount input {
    width: 150px;
}

.deposit-status {
    margin: 20px 0;
    padding: 15px;
    background: var(--surface-light);
    border-radius: var(--border-radius);
    text-align: center;
}

/* Withdraw Modal */
#withdraw-modal .modal-content {
    max-width: 500px;
    width: 95%;
    margin: auto;
}

#withdraw-modal .modal-body {
    padding: 20px;
}

.withdraw-balance {
    text-align: center;
    font-size: 1.1em;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--surface-light);
    border-radius: var(--border-radius);
}

.withdraw-balance strong {
    color: var(--primary);
}

.withdraw-input {
    margin-bottom: 15px;
}

.withdraw-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.withdraw-input textarea {
    width: 100%;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-family: 'Consolas', monospace;
    font-size: 0.85em;
    resize: vertical;
}

.withdraw-input textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.withdraw-note {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
}

#withdraw-form .btn-primary {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
}

.withdraw-success {
    text-align: center;
    padding: 30px 20px;
}

.withdraw-success .success-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.withdraw-success h4 {
    color: var(--success);
    margin-bottom: 15px;
}

.withdraw-success p {
    margin: 10px 0;
}

#withdraw-result .btn-secondary {
    width: 100%;
    margin-top: 20px;
}

.deposit-amount-display {
    text-align: center;
    font-size: 1.2em;
    margin: 15px 0;
}

/* ===========================================
   Admin Dashboard
   =========================================== */
.admin-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 30px;
}

.admin-container h3 {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--warning);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface-light);
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: 5px;
}

.admin-section {
    background: var(--surface-light);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.admin-section h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--surface);
}

#admin-users-list, #admin-transactions-list {
    max-height: 300px;
    overflow-y: auto;
}

.admin-user-item, .admin-tx-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--surface);
}

.admin-user-item:last-child, .admin-tx-item:last-child {
    border-bottom: none;
}

.user-info-admin {
    flex: 1;
}

.user-name {
    font-weight: bold;
}

.user-meta {
    font-size: 0.85em;
    color: var(--text-muted);
}

.user-balance {
    font-weight: bold;
    color: var(--primary);
}

/* Commission Chart (simple bar chart) */
#admin-commissions-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.commission-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.commission-date {
    min-width: 80px;
    font-size: 0.85em;
    color: var(--text-muted);
}

.commission-fill {
    height: 20px;
    background: linear-gradient(90deg, var(--primary), var(--warning));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.commission-value {
    font-size: 0.9em;
    min-width: 80px;
}

/* Pagination */
#transactions-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.pagination-btn {
    padding: 8px 15px;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    color: var(--text);
    cursor: pointer;
}

.pagination-btn:hover {
    background: var(--surface-light);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Admin Settings Section */
.admin-settings-section {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 100, 0, 0.05));
    border: 1px solid var(--warning);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-item label {
    color: var(--text-muted);
    font-size: 0.9em;
}

.setting-value {
    color: var(--text);
    font-weight: bold;
    font-size: 1.1em;
}

.setting-input-group {
    display: flex;
    gap: 10px;
}

.setting-input-group input {
    flex: 1;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    color: var(--text);
}

/* Admin Nodes Grid */
.admin-nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.admin-node-card {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    padding: 15px;
    transition: border-color 0.2s;
}

.admin-node-card.node-outdated {
    border-color: var(--error);
    background: rgba(255, 82, 82, 0.1);
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.node-name {
    font-weight: bold;
    font-size: 1.1em;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75em;
}

.badge-busy {
    background: rgba(255, 82, 82, 0.2);
    color: var(--error);
}

.badge-free {
    background: rgba(0, 230, 118, 0.2);
    color: var(--success);
}

.node-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.node-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
}

.node-detail .label {
    color: var(--text-muted);
}

.version-ok {
    color: var(--success);
}

.version-outdated {
    color: var(--error);
    font-weight: bold;
}

.node-id {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--surface-light);
    font-size: 0.75em;
    color: var(--text-muted);
    font-family: monospace;
    word-break: break-all;
}

/* ===========================================
   Responsive - Large Screens (Full HD, 4K)
   =========================================== */
@media (min-width: 1920px) {
    #deposit-modal .modal-content {
        max-width: 550px;
    }
    
    #deposit-qr-code {
        padding: 25px;
    }
    
    #deposit-qr-code canvas,
    #deposit-qr-code img,
    #deposit-qr-code svg {
        width: 280px !important;
        height: 280px !important;
    }
    
    .invoice-text {
        max-width: 450px;
    }
    
    .deposit-amount-display {
        font-size: 1.4em;
    }
}

/* 4K Screens */
@media (min-width: 2560px) {
    #deposit-modal .modal-content {
        max-width: 650px;
    }
    
    #deposit-qr-code {
        padding: 30px;
    }
    
    #deposit-qr-code canvas,
    #deposit-qr-code img,
    #deposit-qr-code svg {
        width: 320px !important;
        height: 320px !important;
    }
    
    .invoice-text {
        max-width: 550px;
    }
    
    .deposit-amount-display {
        font-size: 1.6em;
    }
    
    .amount-btn {
        padding: 16px;
        font-size: 1.1em;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #deposit-modal .modal-content {
        width: 98%;
        max-height: 90vh;
    }
    
    #deposit-qr-code {
        padding: 15px;
    }
    
    .invoice-text {
        flex-direction: column;
    }
    
    .amount-buttons {
        grid-template-columns: 1fr;
    }
}