/* Options Strategy Dashboard - Modern UI */

:root {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-surface-hover: #334155;
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-border: #334155;
    --color-bullish: #22c55e;
    --color-bearish: #ef4444;
    --color-neutral: #eab308;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 12px;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.4;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.login-box h1 {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 1rem;
}

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

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

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

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

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

/* Dashboard */
.dashboard-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 8px;
    overflow: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
}

.dashboard-header h1 {
    font-size: 14px;
    font-weight: 600;
}

.btn-logout {
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    border: 1px solid var(--color-border);
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-status {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.btn-zerodha {
    background: #f59e0b;
    color: #0f172a;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
}

.btn-zerodha:hover {
    background: #d97706;
}

.price-change {
    font-size: 0.9em;
    margin-left: 4px;
    font-weight: 600;
}

.price-change.positive {
    color: #00c853;
}

.price-change.negative {
    color: #ff5252;
}

.price-change.neutral {
    color: #9e9e9e;
}

.sentiment-bullish {
    color: var(--color-bullish);
}

.sentiment-bearish {
    color: var(--color-bearish);
}

.sentiment-neutral {
    color: var(--color-neutral);
}

.dashboard-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Top summary strip */
.top-strip {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    background: #0f1b2d;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 10px;
}

.top-strip span {
    padding-right: 12px;
    font-size: 13px;
}

/* Grid layout */
.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

/* 2-column row: Breakout + Decision only */
.dashboard-row-2 {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.breakout-card,
.decision-card {
    width: 100%;
}

.grid-item {
    background: #0f1b2d;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.grid-item b {
    font-weight: 600;
}

/* Breakout block - highlighted */
.breakout-card {
    border-left: 4px solid #00c8ff;
    background: #0d223a;
}

/* Decision block - highlighted */
.decision-card {
    border-left: 4px solid #ff4d4d;
    font-weight: bold;
    background: #1a1f2e;
}

.decision-card b {
    font-size: 14px;
}

/* Compact footer */
.compact-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.strategy-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    font-size: 11px;
}

.strategy-table th,
.strategy-table td {
    padding: 10px 8px;
    text-align: center;
    white-space: nowrap;
    font-size: 13px;
}

.strategy-table th {
    background: var(--color-bg);
    font-weight: 600;
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.strategy-table tbody tr {
    border-top: 1px solid var(--color-border);
}

.strategy-table tbody tr:hover {
    background: var(--color-surface-hover);
}

.trend-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.trend-bullish {
    background: rgba(34, 197, 94, 0.2);
    color: var(--color-bullish);
}

.trend-bearish {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-bearish);
}

.trend-neutral {
    background: rgba(234, 179, 8, 0.2);
    color: var(--color-neutral);
}

.trend-data-unavailable,
.trend-data-pending {
    background: rgba(148, 163, 184, 0.2);
    color: var(--color-text-muted);
}

/* Zone badges */
.zone-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.zone-near-support {
    background: rgba(34, 197, 94, 0.2);
    color: var(--color-bullish);
}

.zone-near-resistance {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-bearish);
}

.zone-mid-range {
    background: rgba(148, 163, 184, 0.2);
    color: var(--color-text-muted);
}

.loading-cell,
.error-cell {
    text-align: center;
    color: var(--color-text-muted);
    padding: 8px;
}

.error-cell {
    color: var(--color-bearish);
}

/* Trade Summary P/L colors */
.pl.profit {
    color: #00c853;
    font-weight: bold;
}

.pl.loss {
    color: #ff1744;
    font-weight: bold;
}

/* Global compact overrides */
.card {
    padding: 12px !important;
    margin-bottom: 10px !important;
    line-height: 1.5;
    min-height: 70px;
}

h3, h4 {
    font-size: 13px;
    margin-bottom: 4px;
}

p {
    margin: 4px 0;
}

/* Signal Priority - color only */
.priority {
    display: inline-block;
    padding: 0 4px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.HIGH, .priority.high {
    color: #00ffcc;
}

.MEDIUM, .priority.medium {
    color: #ffaa00;
}

.LOW, .priority.low {
    color: #888;
}

/* Trade Phase Colors */
.trade-phase.REVERSAL_RISK,
#trade-phase.REVERSAL_RISK {
    color: red;
    font-weight: bold;
}

.trade-phase.TREND_CONTINUATION,
.trade-phase.CONFIRMED_TREND,
.trade-phase.EARLY_BUILDUP {
    color: #22c55e;
}

.trade-phase.CONSOLIDATION {
    color: #f59e0b;
}

.trade-phase.LATE_MOVE,
.trade-phase.WEAKENING,
.trade-phase.UNDEFINED {
    color: #f59e0b;
}

/* Responsive */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    .dashboard-row-2 {
        grid-template-columns: 1fr;
    }

    .strategy-table th,
    .strategy-table td {
        font-size: 11px;
        padding: 8px 6px;
    }
}

@media (max-width: 640px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .strategy-table th,
    .strategy-table td {
        padding: 4px;
        font-size: 10px;
    }
}
