:root {
    --bg-color: #0F172A;
    --card-bg: #1E293B;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --accent: #3B82F6;
    --success: #22C55E;
    --danger: #EF4444;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    box-sizing: border-box;
    /* Fix padding calculation */
}

input,
select,
button {
    box-sizing: border-box;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    /* Adjusted spacing */
    padding-bottom: 20px;
    border-bottom: 1px solid #334155;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
}

.highlight {
    color: var(--accent);
}

.status-badge {
    font-size: 12px;
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* --- UNIFIED CARD SYSTEM --- */
.card,
.control-panel,
.hot-picks-container,
.stats-card,
.history-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Specific Overrides */
.result-card {
    padding: 32px;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

/* Merged into generic card above, kept for specific overrides if needed */
/* .control-panel {} */

.hot-picks-container {
    position: relative;
    padding-bottom: 16px;
}

/* History Specifics */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    color: #F8FAFC;
    font-size: 14px;
}

th {
    text-align: left;
    color: #64748B;
    font-weight: 600;
    padding: 12px 8px;
    border-bottom: 1px solid #334155;
    font-size: 12px;
}

td {
    padding: 16px 8px;
    border-bottom: 1px solid #1E293B;
}

tr:last-child td {
    border-bottom: none;
}

.refresh-btn {
    background: none;
    border: none;
    color: #64748B;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
}

.refresh-btn:hover {
    color: white;
}

.status-waiting {
    background: #334155;
    color: #94A3B8;
}

.status-win {
    background: #14532D;
    color: #4ADE80;
}

.status-loss {
    background: #7F1D1D;
    color: #F87171;
}

.status-tie {
    background: #4B5563;
    color: #D1D5DB;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* Controls Inputs*/
.input-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

select,
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 16px;
    background: #0F172A;
    border: 1px solid #334155;
    color: white;
    font-size: 16px;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

select:focus,
input[type="text"]:focus,
textarea:focus {
    border-color: var(--accent);
}

input[type="text"]::placeholder {
    color: #64748B;
}

.search-container {
    position: relative;
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1E293B;
    border: 1px solid #334155;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    color: #F8FAFC;
    font-size: 14px;
    border-bottom: 1px solid #334155;
}

.suggestion-item:hover {
    background: #334155;
}

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

.suggestion-item .pair {
    font-weight: 600;
}

.suggestion-item .ticker {
    color: #94A3B8;
    font-size: 12px;
    margin-left: 8px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 16px top 50%;
    background-size: 12px auto;
}

button {
    width: 100%;
    margin-top: 20px;
    padding: 18px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

button:hover {
    background-color: #2563EB;
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Analysis Results */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.signal-header .label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
}

.signal-header h1 {
    font-size: 64px;
    margin: 10px 0;
    line-height: 1;
}

.signal-buy {
    color: var(--success);
}

.signal-sell {
    color: var(--danger);
}

.signal-neutral {
    color: var(--text-muted);
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin: 32px 0;
}

.metric {
    background: #0F172A;
    padding: 12px;
    border-radius: 8px;
}

.metric .label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric .value {
    font-size: 14px;
    font-weight: 700;
}

.progress-bar {
    height: 6px;
    background: #334155;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-bar .fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.5s ease;
}

.reasoning-box {
    text-align: left;
    background: #0F172A;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

.reasoning-box h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--accent);
}

.reasoning-box p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #CBD5E1;
}

/* Loader */
.loader {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: none;
    margin-left: 10px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Live Trade Animations */
@keyframes flashGreen {
    0% {
        background: rgba(34, 197, 94, 0.2);
        color: #4ADE80;
    }

    50% {
        background: rgba(34, 197, 94, 0.5);
        color: #ffffff;
    }

    100% {
        background: rgba(34, 197, 94, 0.2);
        color: #4ADE80;
    }
}

@keyframes flashRed {
    0% {
        background: rgba(239, 68, 68, 0.2);
        color: #F87171;
    }

    50% {
        background: rgba(239, 68, 68, 0.5);
        color: #ffffff;
    }

    100% {
        background: rgba(239, 68, 68, 0.2);
        color: #F87171;
    }
}

.flash-win {
    animation: flashGreen 1.5s infinite;
    font-weight: 800;
}

.flash-loss {
    animation: flashRed 1.5s infinite;
    font-weight: 800;
}

/* Hot Picks Styling */
.hot-picks-list {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.hot-picks-list::-webkit-scrollbar {
    height: 6px;
}

.hot-picks-list::-webkit-scrollbar-thumb {
    background-color: #334155;
    border-radius: 3px;
}

.hot-pick-card {
    background: #0F172A;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 14px;
    min-width: 130px;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hot-pick-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.hot-pick-asset {
    font-weight: 700;
    font-size: 13px;
    color: #F8FAFC;
    margin-bottom: 4px;
}

.hot-pick-signal {
    font-weight: 800;
    font-size: 12px;
    margin-bottom: 4px;
}

.hot-pick-conf {
    font-size: 10px;
    color: #94A3B8;
}

.section-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hot-pick-loader {
    width: 100%;
    text-align: center;
    color: #64748B;
    padding: 20px;
    font-size: 13px;
    font-style: italic;
}

/* Stats Card Styling */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stats-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.chart-container {
    position: relative;
    height: 100px;
    width: 100px;
    flex-shrink: 0;
}

.stats-metrics {
    flex: 1;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    border-bottom: 1px solid #334155;
    padding-bottom: 8px;
}

.stat-row .label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-row .value {
    font-size: 20px;
    font-weight: 800;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.mini-stat {
    background: #0F172A;
    padding: 8px;
    border-radius: 8px;
    text-align: center;
}

.mini-stat .lbl-small {
    display: block;
    font-size: 9px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.mini-stat .val-small {
    font-size: 13px;
    font-weight: 700;
}

.text-green {
    color: var(--success);
}

.text-red {
    color: var(--danger);
}

/* Email System Extras */
.template-item {
    padding: 12px;
    border-bottom: 1px solid #334155;
    cursor: pointer;
    transition: background 0.2s;
}

.template-item:hover {
    background: #334155;
}

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

.template-item.active {
    background: #334155;
    border-left: 3px solid var(--accent);
}


/* --- PAYWALL & MODALS --- */
/* Removed blur - using clear lockout overlay instead */

.locked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.95);
    z-index: 100;
    border-radius: 16px;
}

.locked-overlay .lock-content {
    text-align: center;
    padding: 40px;
    max-width: 400px;
}

.locked-overlay .lock-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.locked-overlay .lock-title {
    font-size: 24px;
    font-weight: 700;
    color: #F8FAFC;
    margin-bottom: 10px;
}

.locked-overlay .lock-message {
    font-size: 16px;
    color: #94A3B8;
    margin-bottom: 25px;
    line-height: 1.5;
}

.locked-overlay .lock-button {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.locked-overlay .lock-button:hover {
    transform: translateY(-2px);
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: #1E293B;
    width: 90%;
    max-width: 400px;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 24px;
    font-weight: 800;
    color: white;
    margin: 0 0 10px 0;
}

.modal-text {
    color: #94A3B8;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 25px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 10px;
}

.btn-secondary {
    background: transparent;
    color: #94A3B8;
    width: 100%;
    padding: 10px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary:hover {
    color: white;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1E293B;
    border: 1px solid #334155;
    padding: 16px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    border-left: 4px solid #EF4444;
}

.toast.success {
    border-left: 4px solid #22C55E;
}

/* Animation for Entry Warning */
@keyframes flashWarning {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.1);
        color: #DC2626;
    }
}

.flash-animation {
    animation: flashWarning 0.5s infinite;
}

@keyframes textBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.blink-text {
    animation: textBlink 1.5s infinite;
}

/* Enhanced Result Card Styling */
.result-card h2 {
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.trade-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.trade-row:last-child {
    border-bottom: none;
}

.trade-row-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trade-row-icon svg {
    color: var(--accent);
    opacity: 0.8;
}

.trade-row-content {
    text-align: left;
}

.trade-row-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.trade-row-value {
    font-size: 15px;
    font-weight: 700;
    color: #F8FAFC;
    font-family: 'Monaco', 'Consolas', monospace;
    /* Tech look for numbers */
}

/* Refined Martingale Section */
.martingale-container {
    background: linear-gradient(145deg, #1E293B, #0F172A);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.martingale-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
}

.martingale-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.martingale-title {
    font-size: 14px;
    font-weight: 700;
    color: #F8FAFC;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.martingale-level {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 12px;
}

.mg-time {
    margin-left: auto;
    font-family: 'Inter', monospace; /* Ensure consistent tabular width if desired */
}

/* Flashing Dot for Active Martingale Step */
.mg-active-dot {
    width: 10px;
    height: 10px;
    background-color: #EF4444; /* Red to indicate active recovery */
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    animation: flashDot 1.2s infinite ease-in-out;
    flex-shrink: 0;
}

@keyframes flashDot {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

.martingale-level:last-child {
    margin-bottom: 0;
}

.mg-badge {
    font-size: 10px;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.1);
    color: #94A3B8;
    padding: 3px 8px;
    border-radius: 4px;
}

.mg-time {
    font-family: 'Monaco', 'Consolas', monospace;
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
}

/* Neutral Warning Refinement */
.neutral-warning {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}


#toastMsg {
    color: #F8FAFC;
    font-size: 14px;
    font-weight: 500;
}

/* --- Hot Picks & Performance Tracker Wrapper --- */
.hot-picks-and-tracker {
    display: flex;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 24px;
    flex-wrap: wrap;
    /* Ensure effective wrapping */
}

.hot-picks-container {
    flex: 1 1 300px;
    /* Allow shrinking but prefer 300px min width */
    /* Takes available space */
    margin-bottom: 0 !important;
    /* Override generic card margin */
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Prevent flex overflow */
}

.performance-tracker-container {
    flex: 0 0 280px;
    /* Do not grow, fixed basis */
    width: auto;
    /* Reset fixed width */
    max-width: 100%;
    /* Ensure it doesn't overflow mobile */
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tracker-stats-row {
    display: flex;
    width: 100%;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.t-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.t-val {
    font-size: 16px;
    font-weight: 700;
}

.t-lbl {
    font-size: 10px;
    color: #64748B;
    margin-top: 2px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hot-picks-and-tracker {
        flex-direction: column;
    }

    .performance-tracker-container {
        width: 100%;
        height: auto;
    }

    /* Vertical Scroll for Hot Picks on Mobile */
    .hot-picks-list {
        flex-direction: column;
        max-height: 320px;
        /* Show ~3.5 items */
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 4px;
        /* Space for scrollbar */
    }
}