/**
 * DistroERP - Modern Distribution ERP Stylesheet
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --secondary-color: #475569;
    --success-color: #10b981;
    --success-soft: #ecfdf5;
    --warning-color: #f59e0b;
    --warning-soft: #fffbeb;
    --danger-color: #ef4444;
    --danger-soft: #fef2f2;
    --info-color: #06b6d4;
    --info-soft: #ecfeff;
    --dark-surface: #0f172a;
    --dark-card: #1e293b;
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-main);
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Typography & Code */
.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Card Styling */
.card-custom {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
}

.card-header-clean {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 700;
}

/* KPI Summary Cards */
.kpi-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 0.95rem 1rem;
    background: #fff;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-card > .d-flex {
    min-width: 0;
    width: 100%;
}

.kpi-card > .d-flex > div:first-child {
    min-width: 0;
    flex: 1 1 0%;
    overflow: hidden;
}

.kpi-card .kpi-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.kpi-icon.primary { background: var(--primary-soft); color: var(--primary-color); }
.kpi-icon.success { background: var(--success-soft); color: var(--success-color); }
.kpi-icon.warning { background: var(--warning-soft); color: var(--warning-color); }
.kpi-icon.danger { background: var(--danger-soft); color: var(--danger-color); }
.kpi-icon.info { background: var(--info-soft); color: var(--info-color); }
.kpi-icon.dark { background: #f1f5f9; color: #1e293b; }

.kpi-card .kpi-value {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: clamp(1.05rem, 1.22vw, 1.35rem) !important;
    font-weight: 800 !important;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    line-height: 1.25 !important;
    margin-top: 0.35rem;
    margin-bottom: 0.25rem;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    text-overflow: ellipsis;
    overflow: hidden;
    letter-spacing: -0.025em;
    min-width: 0;
    width: 100%;
    display: block !important;
}

.kpi-card .kpi-value .currency-sym {
    font-size: 0.8em;
    font-weight: 600;
    opacity: 0.85;
    margin-right: 2px;
}

.kpi-card .kpi-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
    margin-bottom: 0;
}

.kpi-card small {
    margin-top: auto;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    line-height: 1.3;
}

/* Navbar & Brand */
.navbar-custom {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.navbar-brand-badge {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Role Selector Badge */
.role-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

/* Tables */
.table-custom {
    margin-bottom: 0;
}

.table-custom th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.775rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table-custom td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background-color: #f1f5f9;
}

/* Badges */
.badge-pill {
    border-radius: var(--radius-full);
    padding: 0.35em 0.8em;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Modals */
.modal-content-custom {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Free Issue Tag */
.badge-free-issue {
    background-color: #8b5cf6;
    color: white;
    font-size: 0.725rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

/* Financial profit badge */
.badge-profit {
    background-color: #059669;
    color: white;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}

/* Responsive Table & Forms */
.table-responsive {
    overflow-x: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Sticky Action Column for Data Tables */
.table-custom th.col-actions,
.table-custom td.col-actions {
    position: sticky;
    right: 0;
    background-color: #ffffff;
    z-index: 2;
    box-shadow: -4px 0 8px -2px rgba(0, 0, 0, 0.08);
    white-space: nowrap !important;
    text-align: center;
}

.table-custom thead th.col-actions {
    background-color: #f8fafc !important;
    z-index: 3;
}

.table-hover tbody tr:hover > td.col-actions {
    background-color: #f1f5f9 !important;
}

.table-custom tfoot td.col-actions {
    background-color: #f8fafc !important;
    z-index: 2;
}

/* Compact Table Styling for Data-Dense Tables */
.table-custom-compact th {
    padding: 0.65rem 0.65rem !important;
}
.table-custom-compact td {
    padding: 0.65rem 0.65rem !important;
}

@media (max-width: 576px) {
    .kpi-card {
        padding: 0.85rem;
    }
    .kpi-card .kpi-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    .table-custom th, .table-custom td {
        padding: 0.55rem 0.6rem;
    }
}

/* Prevent layout overflow & horizontal scrollbars */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

@media (min-width: 992px) and (max-width: 1399.98px) {
    .navbar-custom .nav-link {
        font-size: 0.8rem !important;
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
    }
    .navbar-brand-badge {
        font-size: 0.85rem;
        padding: 4px 8px;
    }
}

