/* Dashboard V2 - Modern Minimalist Design */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1d29 0%, #0f1117 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
}

/* Pairing Screen */
.pairing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.pairing-code {
    font-size: 6rem;
    font-weight: 900;
    color: #ff69b4;
    letter-spacing: 1rem;
    margin: 2rem 0;
    font-family: 'Courier New', monospace;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1vh 1vw;
    gap: 1vh;
}

/* KPI Hero Section */
.kpi-hero {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 1vw;
}

.kpi-card {
    background: linear-gradient(135deg, #242837 0%, #1a1d29 100%);
    border-radius: 12px;
    padding: 1.2vh 1vw;
    border: 1px solid #3a3f52;
    display: flex;
    gap: 1vw;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.kpi-card.primary {
    background: linear-gradient(135deg, #1e3a5f 0%, #1a1d29 100%);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.kpi-card.alert {
    background: linear-gradient(135deg, #3d1e1e 0%, #1a1d29 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.kpi-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.kpi-content {
    flex: 1;
}

.kpi-content h3 {
    font-size: clamp(0.8rem, 0.9vw, 1rem);
    color: #9ca3af;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 0.5vh;
}

.kpi-amount {
    font-size: clamp(2.5rem, 3.5vw, 4rem);
    font-weight: 900;
    color: #4ade80;
    line-height: 1;
    margin-bottom: 0.5vh;
}

.kpi-value {
    font-size: clamp(2rem, 2.8vw, 3.2rem);
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.kpi-value.labor-green {
    color: #4ade80;
}

.kpi-value.labor-yellow {
    color: #fbbf24;
}

.kpi-value.labor-red {
    color: #ef4444;
}

.kpi-label,
.kpi-meta {
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: #9ca3af;
    margin-top: 0.5vh;
}

.kpi-label.status-indicator {
    color: #fbbf24;
    font-weight: 600;
}

.kpi-label.status-indicator.on-target {
    color: #4ade80;
}

.kpi-label.status-indicator.watch-level {
    color: #fbbf24;
}

.kpi-label.status-indicator.critical {
    color: #ef4444;
}

.kpi-meta span {
    color: #fff;
    font-weight: 600;
}

.kpi-progress {
    width: 100%;
    height: 8px;
    background: #2d3142;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1vh;
}

.kpi-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
    border-radius: 4px;
    transition: width 1s ease, background 0.5s ease;
}

/* Metrics Bar */
.metrics-bar {
    display: flex;
    gap: 0.8vw;
    flex-wrap: wrap;
    padding: 1vh 1.5vw;
    background: rgba(36, 40, 55, 0.5);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.metric-pill {
    display: flex;
    align-items: center;
    gap: 0.4vw;
    padding: 0.6vh 1vw;
    background: rgba(42, 47, 64, 0.8);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-pill.datetime-pill {
    background: linear-gradient(135deg, rgba(255, 105, 180, 0.15) 0%, rgba(42, 47, 64, 0.8) 100%);
    border: 1px solid rgba(255, 105, 180, 0.3);
    margin-left: auto;
}

.metric-pill .datetime {
    font-size: clamp(1.1rem, 1.4vw, 1.7rem);
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.metric-label {
    font-size: clamp(0.85rem, 0.95vw, 1.05rem);
    color: #9ca3af;
    font-weight: 500;
}

.metric-value-pill {
    font-size: clamp(1rem, 1.2vw, 1.4rem);
    font-weight: 700;
    color: #fff;
}

.metric-value-pill.success {
    color: #4ade80;
}

.metric-value-pill.warning {
    color: #fbbf24;
}

.metric-value-pill.critical {
    color: #ef4444;
}

.metric-value-pill.error {
    color: #ef4444;
}

.metric-star {
    font-size: 1.1rem;
}

.status-dot {
    font-size: 1.2rem;
}

.status-dot.success {
    color: #4ade80;
}

.status-dot.warning {
    color: #fbbf24;
}

.status-dot.critical {
    color: #ef4444;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1.8fr 1fr;
    gap: 1vw;
    flex: 1;
    overflow: hidden;
}

.grid-col {
    display: flex;
    flex-direction: column;
    gap: 1vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Card Styles */
.card {
    background: linear-gradient(135deg, #242837 0%, #1f2332 100%);
    border-radius: 12px;
    border: 1px solid #3a3f52;
    padding: 1vh 1vw;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5vh;
    padding-bottom: 0.7vh;
    border-bottom: 2px solid rgba(255, 105, 180, 0.2);
}

.card-header h2 {
    font-size: clamp(1.1rem, 1.4vw, 1.6rem);
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5vw;
}

.cleaning-stats {
    display: flex;
    gap: 0.8vw;
    font-size: clamp(0.9rem, 1.1vw, 1.2rem);
    color: #9ca3af;
    align-items: center;
}

.cleaning-stats .stat-divider {
    color: #6b7280;
}

.priority-legend {
    display: flex;
    gap: 1vw;
    font-size: clamp(0.9rem, 1.1vw, 1.2rem);
    color: #9ca3af;
    padding: 0.8vh 0;
    margin-bottom: 0.5vh;
}

.priority-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 0.3vw;
}

/* PIC Card */
.pic-card {
    flex-shrink: 0;
}

.pic-display-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5vw;
    padding: 1vh 1vw;
}

.pic-header {
    font-size: clamp(1.4rem, 1.8vw, 2.2rem);
    font-weight: 800;
    color: #fff;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pic-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3a3f52 0%, #242837 100%);
    border: 4px solid #ff69b4;
    box-shadow: 0 8px 24px rgba(255, 105, 180, 0.4);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.pic-name {
    font-size: clamp(1.3rem, 1.6vw, 2rem);
    font-weight: 800;
    color: #ff69b4;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Notes Card */
.notes-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.2vh;
}

.notes-list li {
    padding: 1.4vh 1.2vw;
    background: rgba(42, 47, 64, 0.5);
    border-left: 3px solid #fbbf24;
    border-radius: 8px;
    font-size: clamp(1.1rem, 1.3vw, 1.5rem);
    color: #e5e7eb;
    line-height: 1.6;
}

.notes-list li.shout-out {
    background: linear-gradient(135deg, rgba(255, 105, 180, 0.2) 0%, rgba(147, 51, 234, 0.2) 100%);
    border-left: 4px solid #ff69b4;
    border-right: 4px solid #9333ea;
    font-size: clamp(1.2rem, 1.4vw, 1.6rem);
    box-shadow: 0 4px 12px rgba(255, 105, 180, 0.3);
}

.notes-placeholder {
    color: #6b7280 !important;
    font-style: italic;
    border-left-color: #3a3f52 !important;
}

/* Cleaning Card */
.cleaning-list-combined {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.2vh;
    padding: 0;
    margin: 0;
}

.cleaning-list-combined li {
    padding: 1.2vh 1.2vw;
    background: rgba(42, 47, 64, 0.3);
    border-radius: 8px;
    font-size: clamp(1.1rem, 1.3vw, 1.5rem);
    color: #c0c5d6;
    display: flex;
    align-items: center;
    gap: 0.8vw;
}

.cleaning-list-combined .area-header {
    background: rgba(255, 105, 180, 0.15);
    padding: 0.8vh 1vw;
    margin-top: 1vh;
    border-left: 3px solid #ff69b4;
}

.cleaning-list-combined .area-header:first-child {
    margin-top: 0;
}

.cleaning-list-combined .area-title {
    font-size: clamp(1.2rem, 1.4vw, 1.6rem);
    font-weight: 700;
    color: #ff69b4;
}

.cleaning-list-combined .area-emoji {
    font-size: 1.4em;
    min-width: 1.5em;
}

/* Legacy cleaning styles for backward compatibility */
.cleaning-tabs {
    display: flex;
    flex-direction: column;
    gap: 1.5vh;
}

.cleaning-section h4 {
    font-size: clamp(1.3rem, 1.6vw, 1.8rem);
    color: #ff69b4;
    margin-bottom: 1.2vh;
    font-weight: 700;
}

.cleaning-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.2vh;
}

.cleaning-list li {
    padding: 1.2vh 1.2vw;
    background: rgba(42, 47, 64, 0.3);
    border-radius: 8px;
    font-size: clamp(1.1rem, 1.3vw, 1.5rem);
    color: #c0c5d6;
    display: flex;
    align-items: center;
    gap: 0.8vw;
}

/* Deliveries Card */
.deliveries-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.delivery-counts {
    display: flex;
    gap: 1vw;
}

.count-badge {
    padding: 0.6vh 1vw;
    border-radius: 12px;
    font-size: clamp(1rem, 1.2vw, 1.4rem);
    font-weight: 700;
}

.count-badge.pending {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid #3b82f6;
}

.count-badge.active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid #22c55e;
}

.map-wrapper {
    flex: 1;
    min-height: 280px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1vh;
}

.delivery-map {
    width: 100%;
    height: 100%;
    min-height: 280px;
    background: #1a1d29;
    border-radius: 12px;
}

.map-legend-inline {
    display: flex;
    gap: 1.5vw;
    flex-wrap: wrap;
    padding: 1vh 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1vh;
}

.legend-dot {
    font-size: clamp(0.85rem, 0.95vw, 1.05rem);
    color: #9ca3af;
    font-weight: 500;
}

.legend-dot.pending {
    color: #3b82f6;
}

.legend-dot.picked {
    color: #fbbf24;
}

.legend-dot.enroute {
    color: #10b981;
}

.legend-dot.late {
    color: #ef4444;
}

.delivery-list {
    flex: 1;
    overflow-y: auto;
}

.loading-state {
    text-align: center;
    color: #6b7280;
    padding: 2vh;
    font-style: italic;
}

/* Sales Detail Card */
.sales-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5vh;
}

.sales-compact .sales-stats-grid {
    gap: 0.3vh;
}

.sales-compact .stat-box {
    padding: 0.3vh 0.5vw;
}

.sales-compact .stat-box .stat-value {
    font-size: clamp(0.95rem, 1.1vw, 1.3rem);
    margin-bottom: 0.1vh;
}

.sales-compact .stat-box .stat-label {
    font-size: clamp(0.7rem, 0.8vw, 0.9rem);
}

.stat-box {
    background: rgba(42, 47, 64, 0.5);
    border-radius: 6px;
    padding: 0.5vh 0.6vw;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-box.wide {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.stat-box .stat-value {
    font-size: clamp(1.1rem, 1.3vw, 1.5rem);
    font-weight: 700;
    color: #fff;
    line-height: 1;
    margin-bottom: 0.2vh;
}

.stat-box .stat-value.highlight {
    color: #4ade80;
}

.stat-box .stat-label {
    font-size: clamp(0.75rem, 0.85vw, 0.95rem);
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Revenue Center Breakdown */
.revenue-center-section {
    margin-top: 1.5vh;
    padding-top: 1.5vh;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.rc-header {
    font-size: clamp(0.9rem, 1.1vw, 1.2rem);
    color: #a5b4fc;
    margin-bottom: 1vh;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rc-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.8vh;
}

.rc-item {
    background: rgba(42, 47, 64, 0.5);
    border-radius: 6px;
    padding: 0.8vh 1vw;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.rc-name {
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: #e5e7eb;
    font-weight: 600;
    margin-bottom: 0.4vh;
}

.rc-stats {
    display: flex;
    gap: 1vw;
    align-items: center;
    font-size: clamp(0.75rem, 0.9vw, 1rem);
}

.rc-sales {
    color: #4ade80;
    font-weight: 700;
}

.rc-percent {
    color: #a5b4fc;
    font-weight: 600;
}

.rc-orders {
    color: #9ca3af;
    margin-left: auto;
}

/* Upsell Card */
.upsell-grid {
    display: flex;
    flex-direction: column;
    gap: 2vh;
}

.upsell-section h4 {
    font-size: clamp(1.3rem, 1.6vw, 1.8rem);
    color: #fbbf24;
    margin-bottom: 1.2vh;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.upsell-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.2vh;
}

.upsell-list li {
    padding: 1.2vh 1.2vw;
    background: rgba(251, 191, 36, 0.1);
    border-left: 3px solid #fbbf24;
    border-radius: 8px;
    font-size: clamp(1.1rem, 1.3vw, 1.5rem);
    color: #fef3c7;
    font-weight: 500;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(42, 47, 64, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 105, 180, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 105, 180, 0.7);
}

/* Responsive adjustments */
@media (max-width: 1600px) {
    .kpi-hero {
        grid-template-columns: 1fr 1fr;
    }
    
    .main-grid {
        grid-template-columns: 1fr 1.5fr 1fr;
    }
}

@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .col-3 {
        grid-column: 1 / -1;
        flex-direction: row;
    }
}
