body { font-family: 'Inter', sans-serif; }

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
.modal { display: none; }
.modal.is-open { display: flex; }
.screen { display: none; }
.screen.is-active { display: block; }
/* Simple scrollbar styling for a better look */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1f2937; }
::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #6b7280; }

.tab-btn.is-active {
    color: #60a5fa; /* blue-400 */
    border-color: #60a5fa; /* blue-400 */
}
.tab-content { display: none; }
.tab-content.is-active { display: block; }

/* Trade Popup Tag Selection styles */
.tag-pill {
    cursor: pointer;
    border: 2px solid transparent; /* Start with a transparent border */
    transition: all 0.15s ease-in-out;
    font-size: 0.7rem; /* Make font smaller than default text-xs */
    line-height: 1; /* Adjust line height for the smaller font */
    opacity: 0.7; /* Make unselected tags slightly faded */
}
.tag-pill:hover {
    opacity: 1;
}
.tag-pill.selected {
    opacity: 1; /* Full opacity when selected */
    transform: scale(1.05); /* Slightly enlarge the pill */
    /* A bright, obvious outline using Tailwind's yellow-400 */
    border-color: #facc15; 
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.5); /* Add a soft glow */
}

/* Drag and Drop styles */
.drop-area {
    border: 2px dashed #4b5563;
    background-color: #1f2937;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
}
.drop-area.drag-over {
    background-color: #374151;
    border-color: #60a5fa;
}
.drop-area.has-file {
    background-color: #166534; /* Green-ish when file is present */
    border-color: #22c55e;
}

/* Daily Performance Grid styles */
.daily-performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Responsive grid for calendar view */
    gap: 1rem; /* Gap between day blocks */
}

.daily-block {
    padding: 1rem;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
}

.daily-block.profitable-day {
    background-color: #166534; /* Green-700 */
}

.daily-block.losing-day {
    background-color: #991b1b; /* Red-700 */
}

.daily-block .date {
    font-size: 0.875rem; /* text-sm */
    color: #D1D5DB; /* gray-300 */
    margin-bottom: 0.25rem;
}

.daily-block .pnl {
    font-size: 1.25rem; /* text-xl */
    font-weight: 700; /* font-bold */
}
@media screen and (max-width: 767px) { /* Applies to screens smaller than Tailwind's 'md' breakpoint */
    .responsive-table thead {
        display: none; /* Hide the original table header on mobile */
    }
    .responsive-table tr {
        display: block;
        border: 1px solid #4b5563; /* border-gray-600 */
        border-radius: 0.5rem;    /* rounded-lg */
        margin-bottom: 0.5rem;      /* mb-2 */
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    }
    .responsive-table td {
        display: block;
        text-align: right;
        padding-left: 50%; /* Make space for the label */
        position: relative;
        border: none; /* Remove the default cell borders */
        padding-bottom: 0.5rem; /* py-2 */
        padding-top: 0.5rem;    /* py-2 */
        padding-right: 1rem;    /* px-4 */
    }
    .responsive-table td:last-child {
        border-bottom: 0;
    }
    .responsive-table td:before {
        content: attr(data-label); /* This is the magic part */
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 1.5rem; /* px-6 */
        font-weight: 600; /* font-semibold */
        text-align: left;
        color: #d1d5db; /* gray-300 */
    }
}
/* Chat Window Transitions and Widths */
#chat-window {
    width: calc(100vw - 2rem);
    height: 384px; /* Your preferred h-96 */
    /* Remove mb-4 if you have it in HTML, or handle it here: */
    margin-bottom: 0; 
    transition: width 0.3s ease-in-out, transform 0.2s ease-in-out;
}

@media (min-width: 640px) {
    #chat-window {
        width: 384px;
    }
    #chat-window.is-wide {
        width: 900px;
    }
}
/* Chat widget mobile spacing to clear global message banner */
@media (max-width: 640px) {
    #chat-widget {
        bottom: 4rem;
    }
}
.screen {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}
.screen.is-loading {
    opacity: 0;
}

/* ── Accountability Calendar ─────────────────────────────── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }

.cal-day-cell {
    background: #1f2937; border-radius: 8px; min-height: 120px;
    padding: 8px; display: flex; flex-direction: column; gap: 4px;
    position: relative; border: 1px solid transparent;
    transition: border-color 0.15s; overflow: visible;
}
.cal-day-cell:hover { border-color: #3b82f6; cursor: default; }
.cal-day-cell.cal-today { border-color: #3b82f6 !important; }
.cal-day-cell.cal-faded { opacity: 0.3; pointer-events: none; }
.cal-day-cell.cal-weekend { background: #1a2332; }

.cal-day-num { font-size: 13px; font-weight: 600; color: #d1d5db; line-height: 1; }
.cal-day-cell.cal-today .cal-day-num {
    background: #3b82f6; color: #fff; width: 24px; height: 24px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px;
}

.cal-badge {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11px; font-weight: 500; padding: 2px 7px;
    border-radius: 9999px; line-height: 1.5;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.cal-badge svg { flex-shrink: 0; }
.cal-badge-journal    { background: #1e3a5f; color: #93c5fd; }
.cal-badge-postmortem { background: #2d1b69; color: #c4b5fd; }
.cal-badge-pnl-pos    { background: #052e16; color: #4ade80; }
.cal-badge-pnl-neg    { background: rgb(206 46 46); color: #fff; }

.cal-badge-clickable { cursor: pointer; transition: filter 0.15s, transform 0.1s; }
.cal-badge-clickable:hover { filter: brightness(1.4); transform: scale(1.07); }

/* Suppress hover-card when a clickable badge inside the same cell is hovered */
.cal-day-cell:has(.cal-badge-clickable:hover) .cal-hover-card { display: none !important; }
.cal-day-cell:hover .cal-hover-card { display: flex; }

.cal-hover-card {
    display: none; flex-direction: column; gap: 5px;
    position: absolute; z-index: 30; top: calc(100% + 6px); left: 0;
    min-width: 190px; background: #111827; border: 1px solid #374151;
    border-radius: 8px; padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6); pointer-events: none;
}
.cal-day-cell:nth-child(7n) .cal-hover-card,
.cal-day-cell:nth-child(7n-1) .cal-hover-card { left: auto; right: 0; }

.cal-summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 768px) { .cal-summary-strip { grid-template-columns: repeat(6, 1fr); } }
.cal-summary-card { background: #1f2937; border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: column; align-items: center; }

.cal-weekday-label {
    text-align: center; font-size: 11px; font-weight: 600; color: #6b7280;
    text-transform: uppercase; letter-spacing: 0.05em; padding-bottom: 4px;
}

.cal-month-nav-btn {
    background: #374151; border: 1px solid #4b5563; color: #d1d5db;
    border-radius: 6px; padding: 4px 10px; font-size: 13px;
    cursor: pointer; transition: background 0.15s;
}
.cal-month-nav-btn:hover { background: #4b5563; color: #fff; }

/* ── Calendar Modal ── */
.cal-modal { display: none; position: fixed; inset: 0; z-index: 50; align-items: center; justify-content: center; }
.cal-modal.open { display: flex; }
.cal-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.65); }
.cal-modal-box {
    position: relative; z-index: 51; background: #111827;
    border: 1px solid #374151; border-radius: 12px;
    width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7); margin: 16px;
    animation: calModalIn 0.18s ease;
}
@keyframes calModalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cal-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #1f2937;
    position: sticky; top: 0; background: #111827; z-index: 1;
}
.cal-modal-body { padding: 20px; }
.cal-modal-close {
    background: none; border: none; color: #6b7280; cursor: pointer;
    font-size: 22px; line-height: 1; padding: 2px 8px; border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.cal-modal-close:hover { color: #fff; background: #374151; }

.cal-modal-stat {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 8px 0; border-bottom: 1px solid #1f2937; font-size: 13px; gap: 12px;
}
.cal-modal-stat:last-child { border-bottom: none; }
.cal-modal-stat-label { color: #9ca3af; flex-shrink: 0; }
.cal-modal-stat-value { color: #f3f4f6; font-weight: 600; text-align: right; }

.cal-entry-card {
    background: #1f2937; border-radius: 8px; padding: 12px 14px;
    margin-bottom: 10px; border-left: 3px solid #4b5563;
}
.cal-entry-card:last-child { margin-bottom: 0; }
.cal-entry-card.cal-journal-card { border-left-color: #3b82f6; }
.cal-entry-card.cal-pm-card      { border-left-color: #8b5cf6; }
.cal-entry-card-title {
    font-size: 12px; font-weight: 600; color: #e5e7eb; margin-bottom: 8px;
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.cal-entry-card-note { font-size: 12px; color: #9ca3af; line-height: 1.6; font-style: italic; margin-top: 8px; padding-top: 8px; border-top: 1px solid #374151; }

.cal-tag-pill { display: inline-block; font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 9999px; background: #374151; color: #d1d5db; }
.cal-tag-pill.cal-tag-green { background: #052e16; color: #4ade80; }
.cal-tag-pill.cal-tag-red   { background: #2d0a0a; color: #f87171; }
.cal-pnl-bar { margin-top: auto; height: 3px; border-radius: 2px; }
/* ═══════════════════════════════════════
   CALENDAR — MOBILE & SMALL SCREEN
   Breakpoint: < 768px (Tailwind md)
═══════════════════════════════════════ */

/* ── Summary strip: 2 cols on mobile, 3 on sm, 6 on md+ ── */
@media (max-width: 767px) {
    .cal-summary-strip {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Month navigator: stack on very small screens ── */
@media (max-width: 400px) {
    .cal-month-nav-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ── Compact cell mode (mobile) ── */
@media (max-width: 767px) {

    /* Smaller cells */
    .cal-day-cell {
        min-height: 64px;
        padding: 5px 4px;
        gap: 3px;
    }

    /* Smaller day number */
    .cal-day-num {
        font-size: 11px;
    }

    .cal-day-cell.cal-today .cal-day-num {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    /* Hide badge pills on mobile — dots are shown instead */
    .cal-badge {
        display: none;
    }

    /* Hide P&L bar on mobile — dot conveys the same info */
    .cal-pnl-bar {
        display: none;
    }

    /* Hide hover cards on mobile — tap opens modal instead */
    .cal-day-cell:hover .cal-hover-card {
        display: none !important;
    }

    /* Make entire cell tappable on mobile */
    .cal-day-cell.cal-tappable {
        cursor: pointer;
    }
    .cal-day-cell.cal-tappable:active {
        background: #374151;
    }
}

/* ── Status dot strip ── */
.cal-dot-strip {
    display: none; /* hidden on desktop */
    flex-direction: row;
    gap: 3px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.cal-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
@media (max-width: 767px) {
    .cal-dot-strip {
        display: flex;
    }
}

/* ── Legend: hide verbose text on mobile, show dots only ── */
@media (max-width: 767px) {
    .cal-legend-desktop {
        display: none;
    }
    .cal-legend-mobile {
        display: flex !important;
    }
}
.cal-legend-mobile {
    display: none;
}
/* ── End Calendar ─────────────────────────────────────────── */