/**
 * JerryTrades — Trading Setup Modal Styles
 *
 * Namespace: .tsm-   (Trading Setup Modal)
 * z-index: 10500 (above strategy wizard at 10000, below any system alerts)
 * Theme: matches app dark palette (#1e293b body, #0f172a inputs, #3b82f6 accent)
 *
 * @version 1.0
 */

/* ── Overlay ─────────────────────────────────────────────────────────────── */

.tsm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10500;
    padding: 1rem;
    animation: tsmFadeIn 0.2s ease-out;
}

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

/* ── Modal container ─────────────────────────────────────────────────────── */

.tsm-modal {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.55);
    animation: tsmSlideUp 0.25s ease-out;
    overflow: hidden;
}

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

/* ── Header ──────────────────────────────────────────────────────────────── */

.tsm-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

.tsm-header-text h3 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #f1f5f9;
}

.tsm-header-text p {
    margin: 0;
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.4;
}

.tsm-close-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    line-height: 1;
    margin-left: 1rem;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.tsm-close-btn:hover {
    color: #f1f5f9;
    background: #334155;
}

/* ── Body ────────────────────────────────────────────────────────────────── */

.tsm-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Section ─────────────────────────────────────────────────────────────── */

.tsm-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tsm-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #3b82f6;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.tsm-section-desc {
    font-size: 0.82rem;
    color: #94a3b8;
    margin: -0.35rem 0 0;
    line-height: 1.4;
}

/* ── Year rows (Yahoo/ESPN prior years) ──────────────────────────────────── */

.tsm-year-row {
    display: grid;
    grid-template-columns: 3.5rem 1fr;
    align-items: center;
    gap: 0.75rem;
}

.tsm-year-label {
    font-size: 0.82rem;
    color: #cbd5e1;
    font-weight: 600;
    text-align: right;
}

.tsm-input {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 7px;
    color: #f1f5f9;
    font-size: 0.85rem;
    padding: 0.45rem 0.7rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
    font-family: inherit;
}

.tsm-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.tsm-input::placeholder {
    color: #475569;
}

/* ── Owner correction table ──────────────────────────────────────────────── */

.tsm-owner-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tsm-owner-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    transition: border-color 0.15s;
}

.tsm-owner-row:hover {
    border-color: #334155;
}

.tsm-owner-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.tsm-owner-team {
    font-size: 0.83rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tsm-owner-name {
    font-size: 0.75rem;
    color: #64748b;
}

.tsm-owner-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.tsm-owner-toggle label {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
    cursor: pointer;
}

/* Custom checkbox */
.tsm-check {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid #475569;
    border-radius: 4px;
    background: #0f172a;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.15s, background 0.15s;
}

.tsm-check:checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

.tsm-check:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

/* ── General settings ────────────────────────────────────────────────────── */

.tsm-setting-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
}

.tsm-setting-label {
    font-size: 0.85rem;
    color: #cbd5e1;
}

.tsm-setting-sublabel {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.15rem;
}

.tsm-input-sm {
    width: 5rem;
    text-align: center;
}

/* ── Notice badge (auto-open prompt) ─────────────────────────────────────── */

.tsm-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    font-size: 0.82rem;
    color: #93c5fd;
    line-height: 1.4;
}

.tsm-notice-icon {
    flex-shrink: 0;
    font-size: 0.9rem;
    margin-top: 0.05rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.tsm-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #334155;
    flex-shrink: 0;
}

.tsm-btn {
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    font-family: inherit;
}

.tsm-btn:active {
    transform: scale(0.97);
}

.tsm-btn-secondary {
    background: #334155;
    color: #cbd5e1;
}

.tsm-btn-secondary:hover {
    background: #475569;
}

.tsm-btn-primary {
    background: #3b82f6;
    color: #fff;
}

.tsm-btn-primary:hover {
    opacity: 0.88;
}

/* ── Gear button in Trade Finder header ──────────────────────────────────── */

.tf-setup-btn {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 7px;
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.tf-setup-btn:hover {
    color: #f1f5f9;
    border-color: #64748b;
    background: #334155;
}

.tf-setup-btn.has-data {
    border-color: #3b82f6;
    color: #60a5fa;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .tsm-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
    }

    .tsm-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .tsm-year-row {
        grid-template-columns: 3rem 1fr;
    }
}
