/* ============================================================================
   Dashboard Redesign Styles
   ============================================================================ */

/* --- Layout Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

@media (max-width: 1023px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .dashboard-section[data-span="6"] { grid-column: span 4; }
    .dashboard-section[data-span="5"] { grid-column: span 4; }
    .dashboard-section[data-span="4"] { grid-column: span 4; }
    .dashboard-section[data-span="3"] { grid-column: span 2; }
    .dashboard-section[data-span="2"] { grid-column: span 2; }
    .dashboard-section[data-span="1"] { grid-column: span 1; }
}

@media (max-width: 767px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-section { grid-column: span 1 !important; }
}

/* --- Section Card (shared) --- */
.dashboard-section {
    background: var(--color-surface, white);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.dashboard-section:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dashboard-section-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-light, #f1f5f9);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-section-grip {
    cursor: grab;
    color: var(--color-text-muted, #cbd5e1);
    font-size: 12px;
    user-select: none;
}

.dashboard-section-grip:active {
    cursor: grabbing;
}

.dashboard-section-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text, #0f172a);
}

.dashboard-section-meta {
    font-size: 12px;
    color: var(--color-text-secondary, #64748b);
}

.dashboard-section-body {
    padding: 16px;
}

.dashboard-section-link {
    font-size: 11px;
    color: var(--color-primary, #ff7f50);
    cursor: pointer;
    font-weight: 500;
}

.dashboard-section-link:hover {
    opacity: 0.8;
}

/* --- Section menu --- */
.dashboard-section-menu-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--color-text-muted, #cbd5e1);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.dashboard-section:hover .dashboard-section-menu-btn {
    opacity: 1;
}

.dashboard-section-menu-btn:hover {
    background: var(--color-bg-hover, #f1f5f9);
    color: var(--color-text-secondary, #64748b);
}

/* --- Header --- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.dashboard-greeting {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text, #0f172a);
}

.dashboard-subtitle {
    font-size: 13px;
    color: var(--color-text-muted, #94a3b8);
    margin-top: 2px;
}

.dashboard-edit-layout-btn {
    padding: 6px 14px;
    background: var(--color-bg-hover, #f1f5f9);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-text-secondary, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dashboard-edit-layout-btn:hover {
    background: var(--color-border, #e2e8f0);
}

/* --- Quick Nav Pills --- */
.dashboard-quick-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.dashboard-nav-pill {
    padding: 6px 14px;
    background: var(--color-surface, white);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-text-secondary, #475569);
    cursor: pointer;
    transition: all 0.15s;
}

.dashboard-nav-pill:hover {
    background: var(--color-bg-hover, #f1f5f9);
}

.dashboard-nav-pill--primary {
    background: var(--color-primary, #ff7f50);
    color: white;
    border-color: var(--color-primary, #ff7f50);
    font-weight: 600;
}

.dashboard-nav-pill--primary:hover {
    opacity: 0.9;
    background: var(--color-primary, #ff7f50);
}

/* --- Attention Banner --- */
.dashboard-attention-banner {
    background: linear-gradient(135deg,
        var(--color-primary-50, #fff7ed),
        var(--color-primary-100, #ffedd5));
    border: 1px solid var(--color-primary-200, #fed7aa);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-attention-banner--hidden {
    display: none;
}

.dashboard-attention-badge {
    background: var(--color-primary, #ff7f50);
    color: white;
    border-radius: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.dashboard-attention-text {
    flex: 1;
    font-size: 12px;
    color: var(--color-primary-900, #7c2d12);
}

.dashboard-attention-link {
    font-size: 11px;
    color: var(--color-primary-700, #c2410c);
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

/* --- Urgency Dots (Action Center) --- */
.urgency-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.urgency-dot--red { background: #ef4444; }
.urgency-dot--amber { background: #f59e0b; }
.urgency-dot--blue { background: #3b82f6; }

/* --- Action Item Row --- */
.action-item {
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.action-item:hover { opacity: 0.85; }
.action-item--red { background: #fef2f2; }
.action-item--amber { background: #fffbeb; }
.action-item--blue { background: #eff6ff; }

.action-item-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text, #0f172a);
}

.action-item-detail {
    font-size: 10px;
    color: var(--color-text-muted, #94a3b8);
}

/* --- Field Status Crew Cards --- */
.crew-card {
    padding: 10px 14px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crew-card--active {
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
}

.crew-card--break {
    background: #fefce8;
    border-left: 3px solid #eab308;
}

.crew-card--empty {
    background: var(--color-bg-hover, #f8fafc);
    border: 1px dashed var(--color-border, #e2e8f0);
    justify-content: center;
}

.crew-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary, #ff7f50);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* --- Pipeline Bar --- */
.pipeline-bar {
    height: 24px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    margin-bottom: 14px;
}

.pipeline-bar-segment {
    transition: width 0.3s ease;
    cursor: pointer;
}

.pipeline-bar-segment:hover {
    opacity: 0.8;
}

.pipeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.pipeline-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.pipeline-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.pipeline-legend-label {
    font-size: 11px;
    color: var(--color-text-secondary, #64748b);
}

.pipeline-legend-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text, #0f172a);
}

/* --- Financial Pulse Metric Cards --- */
.finance-metric {
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.finance-metric--green { background: #f0fdf4; }
.finance-metric--amber { background: #fffbeb; }
.finance-metric--neutral { background: var(--color-bg-hover, #f8fafc); }

.finance-metric-value {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.finance-metric-label {
    font-size: 10px;
    color: var(--color-text-secondary, #64748b);
    margin-top: 2px;
}

/* --- Recent Projects Table --- */
.recent-projects-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 80px;
    padding: 8px 16px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--color-text-muted, #94a3b8);
    font-weight: 600;
    border-bottom: 1px solid var(--color-border-light, #f1f5f9);
}

.recent-projects-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 80px;
    padding: 10px 16px;
    align-items: center;
    border-bottom: 1px solid var(--color-bg-hover, #f8fafc);
    cursor: pointer;
    transition: background 0.1s;
}

.recent-projects-row:hover {
    background: var(--color-bg-hover, #f8fafc);
}

.recent-projects-row:last-child {
    border-bottom: none;
}

/* --- Status Badge --- */
.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    display: inline-block;
}

/* --- Tech: Clock-In Status --- */
.clock-in-card {
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clock-in-card--active {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #bbf7d0;
}

.clock-in-card--inactive {
    background: var(--color-bg-hover, #f8fafc);
    border: 1px solid var(--color-border, #e2e8f0);
}

.clock-in-elapsed {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* --- Tech: My Projects --- */
.my-project-row {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-bg-hover, #f8fafc);
    transition: background 0.1s;
}

.my-project-row:hover {
    background: var(--color-bg-hover, #f8fafc);
}

.my-project-row:last-child {
    border-bottom: none;
}

.my-project-row--active {
    background: #fffbeb;
    border-left: 3px solid var(--color-primary, #ff7f50);
}

.my-project-row--active:hover {
    background: #fff7ed;
}

/* --- Tech: Punch List Items --- */
.punch-item {
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.punch-item:hover { opacity: 0.85; }
.punch-item--overdue { background: #fef2f2; }
.punch-item--open { background: var(--color-bg-hover, #f8fafc); }

/* --- Tech: Time Bar Chart --- */
.time-bars {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 80px;
    padding-bottom: 4px;
}

.time-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.time-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
}

.time-bar--approved { background: var(--color-primary, #ff7f50); opacity: 0.9; }
.time-bar--today { background: #22c55e; opacity: 0.7; }
.time-bar--upcoming { background: #e2e8f0; }

.time-bar-label {
    font-size: 10px;
    color: var(--color-text-secondary, #64748b);
}

.time-bar-value {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text, #0f172a);
}

/* --- Drag and Drop States --- */
.dashboard-section.dragging {
    opacity: 0.5;
    transform: scale(0.98) rotate(1deg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.dashboard-section.drag-over {
    box-shadow: 0 0 0 2px var(--color-primary, #ff7f50);
}

/* --- Resize Handle --- */
.dashboard-section-resize {
    position: absolute;
    right: -4px;
    top: 8px;
    bottom: 8px;
    width: 8px;
    cursor: col-resize;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    border-radius: 4px;
    z-index: 2;
}

.dashboard-section:hover .dashboard-section-resize,
.layout-editing .dashboard-section-resize {
    opacity: 0.6;
    background: var(--color-primary, #ff7f50);
}

.dashboard-section-resize:hover {
    opacity: 1 !important;
    background: var(--color-primary, #ff7f50) !important;
    width: 10px;
    right: -5px;
}

/* --- Edit Layout Mode --- */
.layout-editing .dashboard-section {
    border: 1px dashed var(--color-primary, #ff7f50);
}

.layout-editing .dashboard-section-grip {
    color: var(--color-primary, #ff7f50);
}

/* --- Entry Animations --- */
.dashboard-section {
    opacity: 0;
    animation: dashSectionFadeIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@keyframes dashSectionFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-section:nth-child(1) { animation-delay: 0.04s; }
.dashboard-section:nth-child(2) { animation-delay: 0.08s; }
.dashboard-section:nth-child(3) { animation-delay: 0.12s; }
.dashboard-section:nth-child(4) { animation-delay: 0.16s; }
.dashboard-section:nth-child(5) { animation-delay: 0.20s; }
.dashboard-section:nth-child(6) { animation-delay: 0.24s; }
.dashboard-section:nth-child(7) { animation-delay: 0.28s; }
.dashboard-section:nth-child(8) { animation-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
    .dashboard-section {
        animation: none;
        opacity: 1;
    }
}

/* --- Count Badge --- */
.count-badge {
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.count-badge--red { background: #ef4444; }
.count-badge--amber { background: #f59e0b; }
.count-badge--blue { background: #3b82f6; }
.count-badge--green { background: #22c55e; }

/* --- Hint Bar --- */
.dashboard-hint {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    font-size: 11px;
    color: var(--color-text-muted, #cbd5e1);
}
