/* ===========================================================
   IPO Tracker Dashboard - Custom Styles
   File ini berisi style tambahan untuk melengkapi Tailwind CSS.
   Mendukung Light Mode (default) dan Dark Mode (class .dark).
   =========================================================== */

/* -------------------- Base & Typography -------------------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar kustom */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.dark ::-webkit-scrollbar-track {
    background: #0f172a;
}
.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}
.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* -------------------- Tombol (Buttons) -------------------- */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success,
.btn-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}
.btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.dark .btn-secondary {
    background: #334155;
    color: #e2e8f0;
    border-color: #475569;
}
.dark .btn-secondary:hover {
    background: #475569;
    color: #f1f5f9;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 1px 2px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 1px 2px rgba(245, 158, 11, 0.3);
}
.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

/* -------------------- Input & Select -------------------- */
.input,
.select-filter {
    width: 100%;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    color: #1e293b;
    transition: all 0.15s;
}
.input:focus,
.select-filter:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.dark .input,
.dark .select-filter {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}
.dark .input::placeholder {
    color: #64748b;
}
.dark .select-filter option {
    background: #1e293b;
    color: #f1f5f9;
}

.input-search {
    width: 100%;
    padding: 0.55rem 0.85rem 0.55rem 2.25rem;
    font-size: 0.875rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    color: #1e293b;
    transition: all 0.15s;
}
.input-search:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.dark .input-search {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}
.dark .input-search::placeholder {
    color: #64748b;
}

.label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.35rem;
}
.dark .label {
    color: #cbd5e1;
}

/* -------------------- Input khusus -------------------- */
/* Field Nama Emiten selalu tampil kapital (uppercase) dengan letter-spacing
   ringan, untuk konsistensi tampilan. Logika uppercase tetap di-handle JS. */
#formEmiten {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* -------------------- Summary Cards -------------------- */
.summary-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent, #3b82f6);
}
.summary-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}
.dark .summary-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.dark .summary-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.summary-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 500;
}
.summary-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 0.25rem;
    word-break: break-word;
    line-height: 1.3;
}
.dark .summary-label {
    color: #94a3b8;
}
.dark .summary-value {
    color: #f1f5f9;
}

/* -------------------- Badge nilai -------------------- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-gray  { background: #f1f5f9; color: #475569; }
.dark .badge-green { background: rgba(34, 197, 94, 0.2);   color: #4ade80; }
.dark .badge-red   { background: rgba(239, 68, 68, 0.2);   color: #f87171; }
.dark .badge-gray  { background: #334155;                  color: #cbd5e1; }

/* -------------------- Chart container -------------------- */
.chart-container {
    position: relative;
    width: 100%;
    height: 260px;
}

/* -------------------- Tabel -------------------- */
table {
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    font-weight: 600;
    letter-spacing: 0.025em;
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.7rem;
    text-transform: uppercase;
}
.dark thead th {
    background: #0f172a;
    color: #cbd5e1;
    border-bottom-color: #334155;
}

tbody td {
    padding: 0.7rem 1rem;
    color: #334155;
    font-size: 0.85rem;
}
.dark tbody td {
    color: #cbd5e1;
}

tbody tr {
    transition: background-color 0.1s;
}
tbody tr:hover {
    background: #f8fafc;
}
.dark tbody tr:hover {
    background: #334155;
}

/* Baris TOTAL/Akumulasi di akhir tabel */
tbody tr.total-row {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-top: 2px solid #3b82f6;
}
tbody tr.total-row:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}
.dark tbody tr.total-row {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.45) 0%, rgba(30, 64, 175, 0.3) 100%);
    border-top: 2px solid #60a5fa;
}
.dark tbody tr.total-row:hover {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.55) 0%, rgba(37, 99, 235, 0.4) 100%);
}

.total-row-sub {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    color: #64748b;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 0.1rem;
}
.dark .total-row-sub {
    color: #94a3b8;
}

.th-sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}
.th-sortable:hover {
    background: #f1f5f9;
}
.dark .th-sortable:hover {
    background: #1e293b;
}
.sort-icon {
    display: inline-block;
    margin-left: 0.25rem;
    color: #94a3b8;
    font-size: 0.7rem;
}
.sort-icon.active-asc::after  { content: '▲'; color: #2563eb; }
.sort-icon.active-desc::after { content: '▼'; color: #2563eb; }
.dark .sort-icon.active-asc::after,
.dark .sort-icon.active-desc::after { color: #60a5fa; }

/* -------------------- Tombol ikon di tabel -------------------- */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    transition: all 0.15s;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn-icon-edit {
    background: #eff6ff;
    color: #2563eb;
}
.btn-icon-edit:hover {
    background: #dbeafe;
}
.dark .btn-icon-edit {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}
.dark .btn-icon-edit:hover {
    background: rgba(59, 130, 246, 0.3);
}
.btn-icon-delete {
    background: #fef2f2;
    color: #dc2626;
}
.btn-icon-delete:hover {
    background: #fee2e2;
}
.dark .btn-icon-delete {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}
.dark .btn-icon-delete:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* -------------------- Modal -------------------- */
#modalForm.flex,
#modalConfirm.flex {
    display: flex !important;
}

/* -------------------- Panel "Akun Saya" (live preview di modal) -------------------- */
.akun-panel {
    margin-top: 0.5rem;
    padding: 0.85rem;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    border: 1px solid #dbeafe;
    border-radius: 0.75rem;
}
.dark .akun-panel {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.6) 0%, rgba(30, 58, 138, 0.25) 100%);
    border-color: #1e3a8a;
}

.akun-panel-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1e40af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
}
.dark .akun-panel-header {
    color: #93c5fd;
}

.akun-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}
.akun-section-divider {
    margin-top: 0.7rem;
    padding-top: 0.6rem;
    border-top: 1px dashed #cbd5e1;
}
.dark .akun-section-title { color: #94a3b8; }
.dark .akun-section-divider { border-top-color: #334155; }

.akun-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
@media (min-width: 480px) {
    .akun-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.akun-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.5rem 0.65rem;
    min-width: 0; /* penting untuk text-overflow di grid */
}
.dark .akun-item {
    background: #0f172a;
    border-color: #334155;
}

.akun-label {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark .akun-label { color: #94a3b8; }

.akun-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 0.15rem;
    word-break: break-word;
    line-height: 1.25;
}
.dark .akun-value { color: #f1f5f9; }

/* Warna nilai profit/equity/gain: hijau untuk positif, merah untuk negatif */
.akun-value.is-positive { color: #059669; }
.akun-value.is-negative { color: #dc2626; }
.dark .akun-value.is-positive { color: #34d399; }
.dark .akun-value.is-negative { color: #f87171; }

/* Warna khusus untuk beberapa metrik agar mudah dibaca */
.akun-value.akun-profit   { color: #059669; }
.akun-value.akun-equity   { color: #1d4ed8; }
.akun-value.akun-gain     { color: #2563eb; }
.akun-value.akun-jumlah   { color: #475569; }
.dark .akun-value.akun-profit   { color: #34d399; }
.dark .akun-value.akun-equity   { color: #93c5fd; }
.dark .akun-value.akun-gain     { color: #60a5fa; }
.dark .akun-value.akun-jumlah   { color: #cbd5e1; }

/* -------------------- Toast -------------------- */
#toast.show {
    display: flex !important;
    transform: translateX(0) !important;
}
.toast-success { background: #10b981; color: white; }
.toast-error   { background: #ef4444; color: white; }
.toast-info    { background: #3b82f6; color: white; }

/* -------------------- Responsive -------------------- */
@media (max-width: 640px) {
    .summary-value { font-size: 0.95rem; }
    thead th { padding: 0.5rem 0.6rem; font-size: 0.65rem; }
    tbody td { padding: 0.5rem 0.6rem; font-size: 0.75rem; }
}

/* -------------------- Print Styles -------------------- */
@media print {
    body { background: white !important; }
    header, footer,
    .btn-primary, .btn-secondary,
    .btn-danger, .btn-success, .btn-warning,
    #searchInput, #filterSelect, .btn-icon {
        display: none !important;
    }
}
