/* Stylesheet for Gold Live Trading S/R Calculator */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: rgba(30, 41, 59, 0.65);
    --bg-panel: rgba(15, 23, 42, 0.8);
    --bg-accent: rgba(51, 65, 85, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);

    --color-text: #f8fafc;
    --color-text-muted: #94a3b8;

    /* Gold Theme Accent Colors */
    --color-primary: #eab308;
    --color-primary-hover: #ca8a04;
    --color-primary-glow: rgba(234, 179, 8, 0.25);

    --color-support: #10b981;
    --color-support-bg: rgba(16, 185, 129, 0.1);
    --color-support-glow: rgba(16, 185, 129, 0.2);

    --color-resistance: #f43f5e;
    --color-resistance-bg: rgba(244, 63, 94, 0.1);
    --color-resistance-glow: rgba(244, 63, 94, 0.2);

    --color-pivot: #f59e0b;
    --color-pivot-bg: rgba(245, 158, 11, 0.1);
    --color-pivot-glow: rgba(245, 158, 11, 0.2);

    --color-close: #38bdf8;

    --glass-blur: 16px;
    --transition-speed: 0.25s;
    --border-radius: 16px;
    --border-radius-sm: 8px;
}

body.light-mode {
    --bg-primary: #f1f5f9;
    --bg-secondary: rgba(255, 255, 255, 0.7);
    --bg-panel: rgba(255, 255, 255, 0.9);
    --bg-accent: rgba(241, 245, 249, 0.9);
    --border-color: rgba(15, 23, 42, 0.08);

    --color-text: #0f172a;
    --color-text-muted: #64748b;

    --color-primary: #ca8a04;
    --color-primary-hover: #a16207;
    --color-primary-glow: rgba(202, 138, 4, 0.15);

    --color-support: #059669;
    --color-support-bg: rgba(5, 150, 105, 0.08);

    --color-resistance: #e11d48;
    --color-resistance-bg: rgba(225, 29, 72, 0.08);

    --color-pivot: #d97706;
    --color-pivot-bg: rgba(217, 119, 6, 0.08);

    --color-close: #0284c7;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Background Ambient Glow Orbs */
.background-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    transition: opacity var(--transition-speed);
}

body.light-mode .glow-orb {
    opacity: 0.06;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background-color: var(--color-primary);
    top: -100px;
    right: -100px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background-color: var(--color-support);
    bottom: -150px;
    left: -150px;
}

/* Container */
.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 32px;
    background: var(--bg-accent);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    text-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
}

.app-header h1 {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #fef08a 0%, var(--color-primary) 50%, var(--color-primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Theme Toggle Button */
.btn-icon {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--color-text);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.btn-icon:hover {
    background: var(--bg-accent);
    transform: scale(1.05);
}

/* Grid Layout */
.app-main-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: start;
}

/* Panels */
.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.panel-body {
    padding: 24px;
}

.full-width {
    grid-column: span 2;
}

/* Exness Terminal Card */
.exness-terminal-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(234, 179, 8, 0.2);
    border-radius: var(--border-radius-sm);
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25), inset 0 0 10px rgba(234, 179, 8, 0.05);
}

body.light-mode .exness-terminal-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%);
    border: 1px solid rgba(202, 138, 4, 0.2);
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 700;
}

.terminal-status {
    display: flex;
    align-items: center;
}

.terminal-symbol {
    background: var(--color-primary-glow);
    color: var(--color-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.terminal-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.stat-box {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

body.light-mode .stat-box {
    background: rgba(0, 0, 0, 0.02);
}

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

.stat-value {
    font-size: 18px;
    font-weight: 800;
    font-family: monospace;
    color: var(--color-text);
}

.terminal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.position-badge {
    background: rgba(56, 189, 248, 0.1);
    color: #0284c7;
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
}

body.light-mode .position-badge {
    background: rgba(2, 132, 199, 0.08);
}

.lot-size-config {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.lot-size-config input {
    width: 65px;
    background: rgba(0,0,0,0.3) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--color-text) !important;
    padding: 4px 6px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    text-align: center !important;
    outline: none !important;
}

body.light-mode .lot-size-config input {
    background: rgba(255, 255, 255, 0.8) !important;
    color: var(--color-text) !important;
}

/* Real-time Status Card */
.realtime-status-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

body.light-mode .realtime-status-card {
    background: rgba(0, 0, 0, 0.02);
}

.realtime-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: var(--color-support);
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 8px var(--color-support);
    animation: pulse 1.5s infinite;
}

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

.live-timestamp {
    font-size: 12px;
    color: var(--color-text-muted);
    font-family: monospace;
}

.realtime-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
}

.control-label {
    font-size: 13px;
    font-weight: 500;
}

.source-info {
    font-size: 11px;
    color: var(--color-text-muted);
    line-height: 1.4;
    font-style: italic;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-accent);
    border: 1px solid var(--border-color);
    transition: var(--transition-speed);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--color-text-muted);
    transition: var(--transition-speed);
}

input:checked + .slider {
    background-color: var(--color-support-bg);
    border-color: var(--color-support);
}

input:checked + .slider:before {
    background-color: var(--color-support);
    transform: translateX(22px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Inputs Form */
.calc-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.calc-form input, .calc-form select {
    width: 100%;
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    color: var(--color-text);
    padding: 12px 16px;
    font-size: 15px;
    border-radius: var(--border-radius-sm);
    outline: none;
    transition: all var(--transition-speed);
}

.calc-form input[readonly] {
    background: rgba(15, 23, 42, 0.4);
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.04);
    cursor: default;
    opacity: 0.8;
}

body.light-mode .calc-form input[readonly] {
    background: rgba(0, 0, 0, 0.04);
    color: #475569;
    border-color: rgba(0, 0, 0, 0.04);
}

.calc-form input:focus:not([readonly]), .calc-form select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* Hide arrow keys */
.calc-form input::-webkit-outer-spin-button,
.calc-form input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.calc-form input[type=number] {
    -moz-appearance: textfield;
}

.input-hint {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.select-group {
    margin-top: 4px;
}

/* Open price container logic */
.id-open-group {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.id-open-group.dimmed {
    opacity: 0.35;
}

/* Buttons */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn-primary {
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    color: #0f172a;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    box-shadow: 0 4px 16px var(--color-primary-glow);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--color-text-muted);
}

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

/* SVG Chart Visualizer */
.chart-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 16px;
}

.svg-container {
    width: 100%;
    max-width: 320px;
    height: 420px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.light-mode .svg-container {
    background: rgba(0, 0, 0, 0.02);
}

/* SVG Styles */
.svg-bg-bar {
    fill: var(--bg-accent);
    rx: 6px;
}

.svg-line-pivot {
    stroke: var(--color-pivot);
    stroke-width: 2.5;
    stroke-dasharray: 4,4;
}

.svg-line-support {
    stroke: var(--color-support);
    stroke-width: 2.5;
}

.svg-line-resistance {
    stroke: var(--color-resistance);
    stroke-width: 2.5;
}

.svg-line-close {
    stroke: var(--color-close);
    stroke-width: 3;
}

.svg-text-label {
    font-size: 11px;
    font-weight: 700;
    fill: var(--color-text-muted);
    font-family: 'Inter', sans-serif;
}

.svg-text-val {
    font-size: 11px;
    font-weight: 600;
    fill: var(--color-text);
    font-family: 'Inter', sans-serif;
}

.svg-pointer-label {
    font-size: 10px;
    font-weight: 800;
    fill: #ffffff;
}

/* Results Table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.results-table th, .results-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.results-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.results-table tbody tr {
    transition: background-color var(--transition-speed);
}

.results-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

body.light-mode .results-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.01);
}

.table-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: 40px !important;
    font-style: italic;
}

/* Row types colors */
.row-resistance {
    background-color: var(--color-resistance-bg);
    color: var(--color-resistance);
}
.row-resistance td:first-child {
    font-weight: 600;
}

.row-support {
    background-color: var(--color-support-bg);
    color: var(--color-support);
}
.row-support td:first-child {
    font-weight: 600;
}

.row-pivot {
    background-color: var(--color-pivot-bg);
    color: var(--color-pivot);
}
.row-pivot td:first-child {
    font-weight: 600;
}

.val-col {
    font-family: monospace;
    font-size: 16px !important;
    font-weight: 600;
}

.pip-col {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Copy Button */
.btn-copy {
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    color: var(--color-text);
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-speed);
}

.btn-copy:hover {
    background: var(--color-primary);
    color: #0f172a;
    border-color: var(--color-primary);
}

body.light-mode .btn-copy:hover {
    color: white;
}

.btn-copy.success {
    background: var(--color-support);
    color: white;
    border-color: var(--color-support);
}

/* Exness Actions Container & Buttons */
.action-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-trade-action {
    flex: 1;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all var(--transition-speed);
    text-transform: uppercase;
}

.btn-trade-buy {
    background-color: var(--color-support);
    color: white;
}

.btn-trade-buy:hover {
    background-color: #059669;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.btn-trade-sell {
    background-color: var(--color-resistance);
    color: white;
}

.btn-trade-sell:hover {
    background-color: #e11d48;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.3);
}

.btn-copy-small {
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    color: var(--color-text-muted);
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.btn-copy-small:hover {
    color: var(--color-text);
    background: rgba(255,255,255,0.08);
    border-color: var(--color-primary);
}

.btn-copy-small.success {
    background: var(--color-support);
    color: white;
    border-color: var(--color-support);
}

/* Toast System */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--color-text);
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.3s ease 2.7s forwards;
    backdrop-filter: blur(10px);
}

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

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

/* Responsive Table */
.table-responsive {
    overflow-x: auto;
}

/* Responsive Design Queries */
@media (max-width: 900px) {
    .app-main-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: span 1;
    }
}

@media (max-width: 480px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-actions {
        flex-direction: column;
    }
    .results-table th, .results-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
    .val-col {
        font-size: 14px !important;
    }
    .action-cell {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Trading Signals Card Styles */
.signals-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.75) 0%, rgba(15, 23, 42, 0.85) 100%);
    border: 1px solid rgba(234, 179, 8, 0.15);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

body.light-mode .signals-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(241, 245, 249, 0.95) 100%);
    border: 1px solid rgba(202, 138, 4, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.signals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.signals-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.win-rate-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    font-family: monospace;
    background-color: var(--color-support-bg);
    color: var(--color-support);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.signals-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.signal-indicator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.indicator-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.indicator-value {
    font-weight: 700;
}

.indicator-value.buy-signal {
    color: var(--color-support);
}

.indicator-value.sell-signal {
    color: var(--color-resistance);
}

.indicator-value.wait-signal {
    color: var(--color-pivot);
}

.btn-signal-action {
    margin-top: 14px;
    width: 100%;
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    border: none;
    color: #0f172a;
    font-weight: 700;
    font-size: 13px;
    padding: 10px 16px;
    box-shadow: 0 4px 12px var(--color-primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn-signal-action:hover:not([disabled]) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

.btn-signal-action[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-accent);
    color: var(--color-text-muted);
    box-shadow: none;
}

/* Dynamic Win Rate Styles in Table */
.win-rate-badge-table {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    font-family: monospace;
    border: 1px solid transparent;
}

.win-badge-high {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-support);
    border-color: rgba(16, 185, 129, 0.3);
}

.win-badge-medium {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--color-pivot);
    border-color: rgba(245, 158, 11, 0.3);
}

.win-badge-low {
    background-color: rgba(56, 189, 248, 0.15);
    color: var(--color-close);
    border-color: rgba(56, 189, 248, 0.3);
}

.win-rate-status {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-left: 6px;
    font-style: italic;
}

