/* Lancelot.bot Styles */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #222;
    --text-primary: #e0e0e0;
    --text-secondary: #999;
    --accent-blue: #4a9eff;
    --accent-green: #00ff88;
    --accent-red: #ff4444;
    --accent-yellow: #ffcc00;
    --border: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
}

.mode-indicator {
    display: inline-block;
    margin-top: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
    letter-spacing: 1px;
}

.mode-shadow {
    background: var(--accent-yellow);
    color: #000;
}

.mode-live {
    background: var(--accent-green);
    color: #000;
}

nav {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 40px;
}

nav a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s;
}

nav a:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-blue);
}

section {
    margin-bottom: 150px; /* Extra space for tooltips on last rows */
}

h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: var(--accent-blue);
}

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

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

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

.table-container {
    overflow-x: auto;
    overflow-y: visible;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    border-bottom: 2px solid var(--border);
}

th {
    text-align: left;
    padding: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--bg-secondary);
}

.mono {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.open {
    color: var(--accent-green);
    font-weight: bold;
}

.closed {
    color: var(--text-secondary);
}

.profit {
    color: var(--accent-green);
    font-weight: bold;
}

.loss {
    color: var(--accent-red);
    font-weight: bold;
}

.form-group {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

input[type="text"] {
    flex: 1;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1em;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-blue);
}

button {
    padding: 12px 24px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover {
    background: #3a8eef;
    transform: translateY(-2px);
}

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

.info-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.info-card h3 {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 8px;
}

.info-card p {
    font-size: 1.2em;
    font-weight: bold;
}

.error-message {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    padding: 20px;
    color: var(--accent-red);
    text-align: center;
}

.back-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent-blue);
}

footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

footer a {
    color: var(--accent-blue);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Notification Banner */
.notification {
    background: rgba(255, 204, 0, 0.1);
    border: 1px solid var(--accent-yellow);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    animation: slideDown 0.3s ease-out;
}

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

.notification-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.notification strong {
    color: var(--accent-yellow);
    font-size: 1.1em;
    flex-shrink: 0;
}

.notification p {
    flex: 1;
    margin: 0;
    color: var(--text-primary);
    min-width: 200px;
}

.btn-setup {
    padding: 10px 20px;
    background: var(--accent-yellow);
    color: #000;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s;
    display: inline-block;
}

.btn-setup:hover {
    background: #ffdd33;
    transform: translateY(-2px);
}

.btn-dismiss {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-dismiss:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Tooltip for full message text */
.tooltip-trigger {
    position: relative;
    cursor: help;
}

/* Floating tooltip container (JavaScript-controlled) */
#floating-tooltip {
    position: fixed;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--accent-blue);
    border-radius: 8px;
    padding: 12px 16px;
    white-space: pre-wrap;
    max-width: 500px;
    min-width: 200px;
    font-size: 0.9em;
    line-height: 1.5;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    word-wrap: break-word;
}

/* Scrollbar styling for long tooltips */
#floating-tooltip::-webkit-scrollbar {
    width: 8px;
}

#floating-tooltip::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

#floating-tooltip::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 4px;
}

#floating-tooltip::-webkit-scrollbar-thumb:hover {
    background: #3a8eef;
}

#floating-tooltip.visible {
    opacity: 1;
}

/* Highlight row when hovering over tooltip trigger */
tr:has(.tooltip-trigger:hover) {
    background: var(--bg-secondary) !important;
    outline: 2px solid var(--accent-blue);
    outline-offset: -1px;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .table-container {
        padding: 10px;
    }

    th, td {
        padding: 8px;
        font-size: 0.9em;
    }

    .notification-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-setup, .btn-dismiss {
        width: 100%;
    }

    /* Smaller tooltip on mobile */
    td [title]:hover::after {
        max-width: 280px;
        font-size: 0.85em;
    }

    /* Modal responsive */
    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .preset-buttons {
        flex-wrap: wrap;
    }

    .btn-preset {
        flex: 1 1 45%;
    }
}

/* ==========================================
   Close Position Modal Styles
   ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3em;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: none;
}

.modal-body {
    padding: 24px;
}

.position-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.position-symbol {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--accent-blue);
}

.position-mint {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.slider-section {
    margin-bottom: 16px;
}

.slider-section label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 0.95em;
}

.slider-section label span {
    color: var(--accent-green);
    font-weight: bold;
    font-size: 1.1em;
}

.percentage-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.percentage-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent-green);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.3);
    transition: transform 0.2s;
}

.percentage-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.percentage-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--accent-green);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.3);
}

.sol-amount-display {
    text-align: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 20px;
}

.sol-amount-display span {
    font-size: 2em;
    font-weight: bold;
    color: var(--accent-green);
}

.preset-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.btn-preset {
    flex: 1;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-preset:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.close-details {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.detail-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.detail-row span:first-child {
    color: var(--text-secondary);
}

.detail-row span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}

.btn-cancel {
    flex: 1;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: var(--bg-primary);
    transform: translateY(-2px);
}

.btn-execute {
    flex: 2;
    padding: 14px;
    background: var(--accent-green);
    border: none;
    color: #000;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: all 0.2s;
}

.btn-execute:hover:not(:disabled) {
    background: #00e67a;
    transform: translateY(-2px);
}

.btn-execute:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-execute.loading {
    background: var(--accent-yellow);
    color: #000;
}

/* ==========================================
   Close Button in Table
   ========================================== */

.btn-close-position {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-close-position:hover {
    background: var(--accent-red);
    color: #fff;
    transform: translateY(-1px);
}

/* ==========================================
   Toast Notifications
   ========================================== */

#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-notification {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-notification.fade-out {
    animation: fadeOutRight 0.3s ease-out forwards;
}

@keyframes fadeOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

.toast-success {
    background: rgba(0, 255, 136, 0.15);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.toast-error {
    background: rgba(255, 68, 68, 0.15);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.toast-icon {
    font-size: 1.2em;
    font-weight: bold;
}

.toast-message {
    flex: 1;
    font-size: 0.95em;
}