/* ═══════════════════════════════════════════════════════════
   IFRS Category Management — Professional Styles
   IAS 7 compliant cash flow category management page
   ═══════════════════════════════════════════════════════════ */

/* ── Page Layout ── */
.ifrs-cat-page {
    padding: 20px 24px;
    max-width: 1600px;
    margin: 0 auto;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Header ── */
.ifrs-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.ifrs-cat-header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 6px;
}

.ifrs-cat-header-left h1 i {
    color: #0d6efd;
    margin-right: 8px;
}

.ifrs-cat-header-badges {
    display: flex;
    gap: 8px;
}

.ifrs-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

.ifrs-badge-standard {
    background: linear-gradient(135deg, #0d6efd15, #0d6efd25);
    color: #0d6efd;
    border: 1px solid #0d6efd30;
}

.ifrs-badge-info {
    background: #f0f0f0;
    color: #666;
    border: 1px solid #e0e0e0;
}

.ifrs-cat-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Buttons ── */
.ifrs-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.ifrs-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.ifrs-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.ifrs-btn-primary { background: #0d6efd; color: white; }
.ifrs-btn-success { background: #198754; color: white; }
.ifrs-btn-danger { background: #dc3545; color: white; }
.ifrs-btn-danger:hover { background: #bb2d3b; }
.ifrs-btn-outline { background: white; color: #333; border: 1px solid #dee2e6; }
.ifrs-btn-outline:hover { background: #f8f9fa; }
.ifrs-btn-ghost { background: transparent; color: #666; }
.ifrs-btn-ghost:hover { color: #333; background: #f0f0f0; }
.ifrs-btn-sm { padding: 5px 12px; font-size: 0.78rem; }

/* ── KPI Strip ── */
.ifrs-kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.ifrs-kpi-card {
    background: white;
    border: 1px solid #e8ecf0;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
    transition: box-shadow 0.2s;
}

.ifrs-kpi-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

.ifrs-kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.ifrs-kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
}

.ifrs-kpi-operating { border-left: 3px solid #0d6efd; }
.ifrs-kpi-operating .ifrs-kpi-value { color: #0d6efd; }
.ifrs-kpi-investing { border-left: 3px solid #fd7e14; }
.ifrs-kpi-investing .ifrs-kpi-value { color: #fd7e14; }
.ifrs-kpi-financing { border-left: 3px solid #6610f2; }
.ifrs-kpi-financing .ifrs-kpi-value { color: #6610f2; }

/* ── Tab Strip ── */
.ifrs-tab-strip {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    background: #f8f9fa;
    border-radius: 10px;
    overflow-x: auto;
}

.ifrs-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: #666;
    transition: all 0.15s;
    white-space: nowrap;
}

.ifrs-tab:hover { background: white; color: #333; }
.ifrs-tab.active { background: white; color: #1a1a2e; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.ifrs-tab small { font-size: 0.7rem; opacity: 0.6; }

.ifrs-tab-operating.active { color: #0d6efd; border-bottom: 2px solid #0d6efd; }
.ifrs-tab-investing.active { color: #fd7e14; border-bottom: 2px solid #fd7e14; }
.ifrs-tab-financing.active { color: #6610f2; border-bottom: 2px solid #6610f2; }

/* ── Loading ── */
.ifrs-loading {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 1rem;
}

.ifrs-loading i { margin-right: 8px; }

/* ── Main Content ── */
.ifrs-cat-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    transition: grid-template-columns 0.25s ease;
}

.ifrs-cat-content.with-panel {
    grid-template-columns: 1fr 340px;
    gap: 16px;
}

.ifrs-cat-tree-wrapper {
    background: white;
    border: 1px solid #e8ecf0;
    border-radius: 10px;
    overflow: hidden;
}

.ifrs-cat-tree-toolbar {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e8ecf0;
}

/* ── TreeGrid Customization ── */
.ifrs-tree-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ifrs-tree-name .fw-bold { font-weight: 700; }

.ifrs-icon-category { color: #0d6efd; font-size: 0.9rem; }
.ifrs-icon-group { color: #fd7e14; font-size: 0.85rem; }
.ifrs-icon-subgroup { color: #6c757d; font-size: 0.8rem; }

.ifrs-system-lock {
    color: #ffc107;
    font-size: 0.7rem;
    margin-left: 4px;
}

.ifrs-code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    background: #f0f4f8;
    padding: 2px 8px;
    border-radius: 4px;
    color: #495057;
}

/* ── Section Badges ── */
.ifrs-section-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.ifrs-section-operating {
    background: #0d6efd12;
    color: #0d6efd;
    border: 1px solid #0d6efd25;
}

.ifrs-section-investing {
    background: #fd7e1412;
    color: #fd7e14;
    border: 1px solid #fd7e1425;
}

.ifrs-section-financing {
    background: #6610f212;
    color: #6610f2;
    border: 1px solid #6610f225;
}

.ifrs-section-balance {
    background: #19875412;
    color: #198754;
    border: 1px solid #19875425;
}

.ifrs-section-calculated {
    background: #6c757d12;
    color: #6c757d;
    border: 1px solid #6c757d25;
}

/* ── Direction Badges ── */
.ifrs-dir-badge {
    display: inline-flex;
    padding: 1px 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
}

.ifrs-dir-inflow { background: #d1e7dd; color: #0f5132; }
.ifrs-dir-outflow { background: #f8d7da; color: #842029; }
.ifrs-dir-neutral { background: #e9ecef; color: #495057; }

/* ── Level Chips ── */
.ifrs-level-chip {
    display: inline-flex;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.ifrs-level-kategori { background: #0d6efd15; color: #0d6efd; }
.ifrs-level-grup { background: #fd7e1415; color: #fd7e14; }
.ifrs-level-alt\ grup { background: #6c757d15; color: #6c757d; }

/* ── IAS 7 Reference Tag ── */
.ifrs-ref-tag {
    font-family: 'Cascadia Code', monospace;
    font-size: 0.68rem;
    color: #0d6efd;
    background: #0d6efd08;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #0d6efd15;
}

/* ── Action Buttons ── */
.ifrs-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.ifrs-act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.12s;
    font-size: 0.78rem;
}

.ifrs-act-btn:hover { background: #f0f0f0; color: #333; }
.ifrs-act-danger:hover { background: #fff0f0; color: #dc3545; }

/* ── Detail Panel ── */
.ifrs-detail-panel {
    background: white;
    border: 1px solid #e8ecf0;
    border-radius: 10px;
    overflow: hidden;
    height: fit-content;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.ifrs-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e8ecf0;
}

.ifrs-detail-header h3 {
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a2e;
}

.ifrs-detail-body { padding: 16px; }

/* ── Detail View ── */
.ifrs-detail-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ifrs-detail-field { }

.ifrs-detail-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.ifrs-detail-value {
    font-size: 0.88rem;
    color: #333;
}

.ifrs-formula {
    display: block;
    padding: 6px 10px !important;
    font-size: 0.75rem !important;
    word-break: break-all;
    white-space: pre-wrap;
}

/* ── Form ── */
.ifrs-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ifrs-form-group label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.ifrs-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: border-color 0.15s;
    background: white;
    box-sizing: border-box;
}

.ifrs-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px #0d6efd15;
}

textarea.ifrs-input { resize: vertical; }

.ifrs-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem !important;
    cursor: pointer;
    text-transform: none !important;
}

.ifrs-section-preview { margin-top: 4px; }

.ifrs-form-actions {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #e8ecf0;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .ifrs-cat-content.with-panel {
        grid-template-columns: 1fr;
    }
    .ifrs-detail-panel {
        position: fixed;
        right: 0;
        top: 0;
        width: 360px;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 1000;
        box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    }
}

@media (max-width: 640px) {
    .ifrs-cat-page { padding: 12px; }
    .ifrs-cat-header { flex-direction: column; align-items: flex-start; }
    .ifrs-kpi-strip { grid-template-columns: repeat(3, 1fr); }
    .ifrs-tab-strip { padding: 2px; }
    .ifrs-tab { padding: 6px 10px; font-size: 0.75rem; }
    .ifrs-tab small { display: none; }
}
