/* css/components.css — Reusable UI components */
/* DETASAD Sales Engine | Depends on: css/main.css */

/* ─────────────────────────────────────────────
   SIDEBAR NAVIGATION
───────────────────────────────────────────── */
.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 0 20px 20px 20px;
}

.sidebar-brand-sub {
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.90);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.nav-section-label {
    padding: 16px 24px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.nav-item i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item:hover,
.nav-item.active {
    color: #6FCCDD;
    background: rgba(111, 204, 221, 0.1);
    border-left-color: #6FCCDD;
}

.nav-item span,
.nav-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item-badge {
    margin-left: auto;
    background: #C5D82D;
    color: #003d55;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(111, 204, 221, 0.2);
    border: 1.5px solid rgba(111, 204, 221, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #6FCCDD;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

/* ─────────────────────────────────────────────
   MOBILE BOTTOM NAVIGATION
───────────────────────────────────────────── */
.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    color: #9CA3AF;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: color 0.2s;
    border-top: 2px solid transparent;
    cursor: pointer;
    background: none;
    border-left: none;
    border-right: none;
    border-bottom: none;
}

.mobile-nav-item i {
    width: 20px;
    height: 20px;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: #005B7F;
    border-top-color: #005B7F;
}

/* ─────────────────────────────────────────────
   PAGE HEADER
───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: #4A4A4A;
    line-height: 1.2;
}

.page-header-left p {
    font-size: 14px;
    color: #6B7280;
    margin-top: 4px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─────────────────────────────────────────────
   SEARCH & FILTER BAR
───────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.search-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #9CA3AF;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border: 1.5px solid #E2E8F0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: #6FCCDD;
    box-shadow: 0 0 0 3px rgba(111, 204, 221, 0.15);
}

.filter-select {
    padding: 9px 14px;
    border: 1.5px solid #E2E8F0;
    border-radius: 8px;
    font-size: 14px;
    color: #4A4A4A;
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select:focus {
    border-color: #6FCCDD;
}

.filter-count {
    font-size: 12px;
    color: #6B7280;
    white-space: nowrap;
    padding: 0 4px;
}

/* ─────────────────────────────────────────────
   STAT / KPI CARDS
───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 91, 127, 0.1);
    transform: translateY(-1px);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    width: 22px;
    height: 22px;
}

.stat-icon-primary {
    background: rgba(0, 91, 127, 0.1);
    color: #005B7F;
}

.stat-icon-cyan {
    background: rgba(111, 204, 221, 0.15);
    color: #4aafc3;
}

.stat-icon-lime {
    background: rgba(197, 216, 45, 0.15);
    color: #7a8800;
}

.stat-icon-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.stat-icon-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.stat-body {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #4A4A4A;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #6B7280;
    font-weight: 500;
}

.stat-sub {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 2px;
}

/* ─────────────────────────────────────────────
   TIMELINE
───────────────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #E2E8F0;
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.timeline-marker i {
    width: 10px;
    height: 10px;
    color: #6B7280;
}

.timeline-marker.marker-primary {
    border-color: #005B7F;
}

.timeline-marker.marker-primary i {
    color: #005B7F;
}

.timeline-marker.marker-cyan {
    border-color: #6FCCDD;
}

.timeline-marker.marker-cyan i {
    color: #6FCCDD;
}

.timeline-marker.marker-lime {
    border-color: #C5D82D;
}

.timeline-marker.marker-lime i {
    color: #7a8800;
}

.timeline-marker.marker-danger {
    border-color: #EF4444;
}

.timeline-marker.marker-danger i {
    color: #EF4444;
}

.timeline-content {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.timeline-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: #4A4A4A;
}

.timeline-meta {
    font-size: 11px;
    color: #9CA3AF;
    white-space: nowrap;
}

.timeline-body {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
}

/* ─────────────────────────────────────────────
   STAGE PROGRESS BAR
───────────────────────────────────────────── */
.stage-progress {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 24px 0;
    overflow-x: auto;
    padding-bottom: 4px;
}

.stage-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    min-width: 80px;
}

/* Connector line between steps */
.stage-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 14px;
    width: 100%;
    height: 2px;
    background: #E2E8F0;
    z-index: 0;
}

.stage-step.completed:not(:last-child)::after {
    background: #005B7F;
}

.stage-step.active:not(:last-child)::after {
    background: #E2E8F0;
}

.stage-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #E2E8F0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    position: relative;
    transition: all 0.2s;
}

.stage-dot i {
    width: 14px;
    height: 14px;
    color: #D1D5DB;
}

.stage-step.completed .stage-dot {
    background: #005B7F;
    border-color: #005B7F;
}

.stage-step.completed .stage-dot i {
    color: #fff;
}

.stage-step.active .stage-dot {
    background: #fff;
    border-color: #6FCCDD;
    box-shadow: 0 0 0 3px rgba(111, 204, 221, 0.2);
}

.stage-step.active .stage-dot i {
    color: #005B7F;
}

.stage-label {
    font-size: 11px;
    font-weight: 500;
    color: #9CA3AF;
    text-align: center;
    line-height: 1.2;
}

.stage-step.completed .stage-label {
    color: #005B7F;
    font-weight: 600;
}

.stage-step.active .stage-label {
    color: #4A4A4A;
    font-weight: 600;
}

/* ─────────────────────────────────────────────
   MULTI-SELECT CHIPS
───────────────────────────────────────────── */
.chip-select {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    border: 1.5px solid #E2E8F0;
    background: #F8FAFC;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.chip i {
    width: 14px;
    height: 14px;
}

.chip:hover {
    border-color: #6FCCDD;
    color: #005B7F;
    background: rgba(111, 204, 221, 0.08);
}

.chip.selected {
    background: rgba(0, 91, 127, 0.08);
    border-color: #005B7F;
    color: #005B7F;
    font-weight: 600;
}

.chip.selected i {
    color: #005B7F;
}

/* ─────────────────────────────────────────────
   TABS
───────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid #E2E8F0;
    margin-bottom: 24px;
    overflow-x: auto;
    gap: 0;
}

.tab-item {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab-item:hover {
    color: #005B7F;
}

.tab-item.active {
    color: #005B7F;
    border-bottom-color: #005B7F;
    font-weight: 600;
}

/* ─────────────────────────────────────────────
   PAGINATION
───────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-top: 1px solid #E2E8F0;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-info {
    font-size: 13px;
    color: #6B7280;
}

.pagination-controls {
    display: flex;
    gap: 4px;
}

.page-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: #fff;
    color: #4A4A4A;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: #6FCCDD;
    color: #005B7F;
}

.page-btn.active {
    background: #005B7F;
    border-color: #005B7F;
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─────────────────────────────────────────────
   TODAY'S ACTIONS CARD
───────────────────────────────────────────── */
.action-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #F3F4F6;
}

.action-item:last-child {
    border-bottom: none;
}

.action-check {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 1px;
    border: 2px solid #E2E8F0;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-check:hover {
    border-color: #6FCCDD;
}

.action-check.checked {
    background: #C5D82D;
    border-color: #C5D82D;
}

.action-check.checked i {
    color: #fff;
    width: 12px;
    height: 12px;
}

.action-body {
    flex: 1;
    min-width: 0;
}

.action-title {
    font-size: 14px;
    font-weight: 600;
    color: #4A4A4A;
}

.action-sub {
    font-size: 12px;
    color: #6B7280;
    margin-top: 2px;
}

.action-overdue {
    color: #EF4444;
}

/* ─────────────────────────────────────────────
   CARD GRID LAYOUTS
───────────────────────────────────────────── */
.card-grid {
    display: grid;
    gap: 16px;
}

.card-grid-2 {
    grid-template-columns: 1fr;
}

.card-grid-3 {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .card-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}