/* ═══════════════════════════════════════════════════════
   💰 DIVIDEND TRACKER — Feature 14.1
   Dividend calendar, history, yield calculator, projections
   ═══════════════════════════════════════════════════════ */

/* ── Page Header ── */
.div-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.div-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 10px;
}
.div-title svg {
    width: 26px;
    height: 26px;
    color: #22c55e;
}

/* ── Summary Cards ── */
.div-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.div-summary-card {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    border-radius: 14px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}
.div-summary-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent, #6366f1);
}
.div-summary-card:hover {
    border-color: rgba(148,163,184,0.15);
}
.div-summary-card.accent-green::before  { background: #22c55e; }
.div-summary-card.accent-orange::before { background: #f97316; }
.div-summary-card.accent-blue::before   { background: #3b82f6; }
.div-summary-card.accent-purple::before { background: #a855f7; }
.div-summary-card .card-icon {
    font-size: 24px;
    margin-bottom: 6px;
}
.div-summary-card .card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.div-summary-card .card-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary, #fff);
    line-height: 1.2;
}

/* ── Tab Bar ── */
.div-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-elevated, #1e293b);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    overflow-x: auto;
}
.div-tab {
    flex: 1;
    min-width: 90px;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted, #94a3b8);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}
.div-tab:hover {
    color: var(--text-primary, #fff);
    background: rgba(255,255,255,0.05);
}
.div-tab.active {
    background: rgba(34,197,94,0.15);
    color: #22c55e;
}
.div-tab .tab-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(34,197,94,0.15);
    color: #22c55e;
}

/* ── Panels ── */
.div-panel {
    display: none;
}
.div-panel.active {
    display: block;
    animation: dvFadeIn 0.25s ease;
}
@keyframes dvFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Calendar View ── */
.div-calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 8px;
}
.div-month-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}
.div-month-nav .month-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    min-width: 140px;
    text-align: center;
}
.div-month-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color, rgba(148,163,184,0.15));
    border-radius: 10px;
    background: var(--card-bg, rgba(30,41,59,0.5));
    color: var(--text-muted, #94a3b8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.div-month-btn:hover {
    color: #22c55e;
    border-color: rgba(34,197,94,0.3);
}
.div-month-btn svg { width: 16px; height: 16px; }
.div-filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.div-filter-pill {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color, rgba(148,163,184,0.15));
    background: transparent;
    color: var(--text-muted, #94a3b8);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.div-filter-pill:hover {
    color: var(--text-primary, #fff);
    border-color: rgba(255,255,255,0.2);
}
.div-filter-pill.active {
    background: rgba(34,197,94,0.15);
    color: #22c55e;
    border-color: rgba(34,197,94,0.3);
}

/* Calendar event cards */
.div-calendar-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.div-event-card {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.2s, transform 0.15s;
    cursor: pointer;
}
.div-event-card:hover {
    border-color: rgba(34,197,94,0.3);
    transform: translateY(-1px);
}
.div-event-date {
    width: 52px;
    text-align: center;
    flex-shrink: 0;
}
.div-event-date .day {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary, #fff);
    line-height: 1.1;
}
.div-event-date .month-short {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.div-event-divider {
    width: 3px;
    height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}
.div-event-divider.ex-date { background: #f97316; }
.div-event-divider.cum-date { background: #3b82f6; }
.div-event-divider.pay-date { background: #22c55e; }
.div-event-divider.record-date { background: #a855f7; }

.div-event-info {
    flex: 1;
    min-width: 0;
}
.div-event-stock {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 8px;
}
.div-event-stock .event-type-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.event-type-badge.ex-date { background: rgba(249,115,22,0.15); color: #f97316; }
.event-type-badge.cum-date { background: rgba(59,130,246,0.15); color: #3b82f6; }
.event-type-badge.pay-date { background: rgba(34,197,94,0.15); color: #22c55e; }
.event-type-badge.record-date { background: rgba(168,85,247,0.15); color: #a855f7; }

.div-event-detail {
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    margin-top: 3px;
}
.div-event-amount {
    text-align: right;
    flex-shrink: 0;
}
.div-event-amount .amount {
    font-size: 14px;
    font-weight: 700;
    color: #22c55e;
}
.div-event-amount .yield {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}

/* ── Holdings Dividend Table ── */
.div-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
}
.div-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}
.div-table thead th {
    background: var(--bg-elevated, #1e293b);
    color: var(--text-muted, #94a3b8);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color, rgba(148,163,184,0.1));
    position: sticky;
    top: 0;
    z-index: 1;
}
.div-table thead th:last-child,
.div-table tbody td:last-child {
    text-align: right;
}
.div-table tbody tr {
    transition: background 0.15s;
}
.div-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}
.div-table tbody td {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-primary, #fff);
    border-bottom: 1px solid var(--border-color, rgba(148,163,184,0.06));
    white-space: nowrap;
}
.div-table .stock-code {
    font-weight: 700;
    color: var(--text-primary, #fff);
}
.div-table .stock-name {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
}
.div-table .yield-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}
.yield-badge.high { background: rgba(34,197,94,0.15); color: #22c55e; }
.yield-badge.medium { background: rgba(249,115,22,0.15); color: #f97316; }
.yield-badge.low { background: rgba(148,163,184,0.15); color: #94a3b8; }

/* ── Projection Section ── */
.div-projection-card {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}
.div-projection-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.div-projection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.div-proj-item {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}
.div-proj-item .proj-label {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.div-proj-item .proj-value {
    font-size: 20px;
    font-weight: 800;
    color: #22c55e;
}
.div-proj-item .proj-sub {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: 3px;
}

/* Chart container */
.div-chart-container {
    position: relative;
    height: 260px;
    margin-top: 16px;
    background: rgba(0,0,0,0.15);
    border-radius: 12px;
    padding: 12px;
}
.div-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── History List ── */
.div-history-card {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}
.div-history-card:hover {
    border-color: rgba(34,197,94,0.2);
}
.div-history-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(34,197,94,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.div-history-info {
    flex: 1;
    min-width: 0;
}
.div-history-info .stock {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #fff);
}
.div-history-info .detail {
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}
.div-history-amount {
    text-align: right;
    flex-shrink: 0;
}
.div-history-amount .amount {
    font-size: 14px;
    font-weight: 700;
    color: #22c55e;
}
.div-history-amount .date {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}

/* ── Empty State ── */
.div-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted, #94a3b8);
}
.div-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}
.div-empty-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin-bottom: 6px;
}
.div-empty-sub {
    font-size: 13px;
}

/* ── Loading ── */
.div-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #94a3b8);
    font-size: 14px;
}
.div-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(34,197,94,0.2);
    border-top-color: #22c55e;
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: dvSpin 0.8s linear infinite;
}
@keyframes dvSpin { to { transform: rotate(360deg); } }

/* ── Reminder Toggle ── */
.div-reminder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.div-reminder-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 8px;
}
.div-reminder-label svg { width: 18px; height: 18px; color: #f97316; }
.div-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.div-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.div-toggle .slider {
    position: absolute;
    inset: 0;
    background: rgba(148,163,184,0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.div-toggle .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.div-toggle input:checked + .slider {
    background: #22c55e;
}
.div-toggle input:checked + .slider::before {
    transform: translateX(20px);
}

/* ── Info Banner ── */
.div-info-banner {
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    line-height: 1.5;
}
.div-info-banner svg { flex-shrink: 0; width: 18px; height: 18px; color: #3b82f6; margin-top: 1px; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .div-summary { grid-template-columns: repeat(2, 1fr); }
    .div-summary-card { padding: 12px 10px; }
    .div-summary-card .card-value { font-size: 16px; }
    .div-tab { min-width: 75px; padding: 8px 10px; font-size: 12px; }
    .div-calendar-controls { flex-direction: column; align-items: stretch; }
    .div-month-nav { justify-content: center; }
    .div-filter-pills { justify-content: center; }
    .div-event-card { padding: 12px; gap: 10px; }
    .div-event-date { width: 44px; }
    .div-event-date .day { font-size: 18px; }
    .div-projection-grid { grid-template-columns: 1fr 1fr; }
    .div-proj-item .proj-value { font-size: 16px; }
    .div-chart-container { height: 200px; }
}
