/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --warning-color: #FF9800;
    --success-color: #4CAF50;
    --text-primary: #212121;
    --text-secondary: #757575;
    --bg-primary: #FAFAFA;
    --bg-secondary: #FFFFFF;
    --border-color: #E0E0E0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container Layout */
.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    padding: 0 24px 32px;
    border-bottom: 1px solid var(--border-color);
}

.logo h2 {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    padding: 16px 0;
}

.nav-item {
    margin: 4px 12px;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.nav-item a:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.nav-item.active a {
    background: #E8F5E9;
    color: var(--primary-color);
    font-weight: 500;
}

.nav-item .icon {
    font-size: 20px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    max-width: 1400px;
}

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

.header-left h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
}

.header-left .date {
    color: var(--text-secondary);
    font-size: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-today {
    background: #E3F2FD;
    color: #1976D2;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status-badge.large {
    padding: 8px 16px;
    font-size: 14px;
}

.status-badge.in-progress {
    background: #E8F5E9;
    color: #2E7D32;
}

.status-badge.scheduled {
    background: #E3F2FD;
    color: #1565C0;
}

.status-badge.completed {
    background: #F3E5F5;
    color: #6A1B9A;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Jobs Section */
.jobs-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Job Cards */
.job-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.job-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.job-card.in-progress {
    border-color: var(--primary-color);
    background: #F1F8F4;
}

.job-card.scheduled {
    border-color: var(--border-color);
}

.job-header {
    margin-bottom: 16px;
}

.job-time {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.time-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.job-body {
    margin-bottom: 16px;
}

.job-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.job-address {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 4px;
}

.job-description {
    color: var(--text-primary);
    font-size: 15px;
    margin-bottom: 12px;
}

.job-meta {
    display: flex;
    gap: 16px;
    align-items: center;
}

.job-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.job-duration {
    font-size: 14px;
    color: var(--text-secondary);
}

.job-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #F5F5F5;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #E0E0E0;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: var(--primary-dark);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-xl {
    padding: 18px 36px;
    font-size: 18px;
    font-weight: 600;
}

.btn-block {
    width: 100%;
}

.btn-back {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-back:hover {
    color: var(--text-primary);
}

/* Job Detail Page */
.job-detail-container {
    max-width: 1200px;
    margin: 0 auto;
}

.job-status-header {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.job-detail-title {
    font-size: 28px;
    font-weight: 600;
    margin-top: 12px;
}

.timer-section {
    display: flex;
    align-items: center;
    gap: 24px;
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 36px;
    font-weight: 600;
    color: var(--primary-color);
}

.timer-icon {
    font-size: 32px;
}

/* Job Detail Grid */
.job-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.detail-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.card-body {
    padding: 24px;
}

/* Address and Client Info */
.address {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.client-info h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.client-type {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.client-contact {
    display: flex;
    gap: 12px;
}

/* Scope Item */
.scope-item {
    display: flex;
    justify-content: space-between;
    align-items: start;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.scope-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.scope-detail {
    font-size: 15px;
    color: var(--text-primary);
}

.scope-price {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Photo Section */
.photo-btn {
    margin-bottom: 20px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.photo-thumbnail {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
}

.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    text-align: center;
}

/* Notes Section */
.notes-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Signature Section */
.signature-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.signature-pad {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.signature-pad:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.signature-placeholder {
    color: var(--text-secondary);
    font-size: 14px;
}

.signature-timestamp {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Job Actions Footer */
.job-actions-footer {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
    }
    
    .job-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        z-index: 100;
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-buttons {
        width: 100%;
        overflow-x: auto;
    }
    
    .job-actions {
        flex-direction: column;
    }
    
    .job-actions .btn {
        width: 100%;
    }
    
    .job-status-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .timer-section {
        width: 100%;
        flex-direction: column;
    }
    
    .job-detail-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .header-left h1 {
        font-size: 24px;
    }
    
    .job-title {
        font-size: 18px;
    }
    
    .timer-display {
        font-size: 28px;
    }
    
    .job-detail-title {
        font-size: 22px;
    }
}

/* Analytics Page Styles */
.date-range-selector {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.date-range-selector:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.kpi-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.trend-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.trend-badge.positive {
    background: #E8F5E9;
    color: #2E7D32;
}

.trend-badge.negative {
    background: #FFEBEE;
    color: #C62828;
}

.kpi-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.kpi-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 40px;
}

.mini-chart .bar {
    flex: 1;
    background: var(--primary-color);
    border-radius: 2px 2px 0 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.mini-chart .bar:hover {
    opacity: 1;
}

.rating-stars {
    font-size: 20px;
    margin-top: 8px;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.chart-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.chart-legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-item .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.chart-body {
    padding: 24px;
}

/* Bar Chart */
.bar-chart {
    height: 250px;
}

.chart-bars {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 100%;
    gap: 16px;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.bar-column {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 100%;
    width: 100%;
}

.bar-column .bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    transition: all 0.3s;
}

.bar-column .bar:hover {
    opacity: 0.8;
}

.bar.primary {
    background: var(--primary-color);
}

.bar.secondary {
    background: #E0E0E0;
}

.bar-label {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Service List */
.service-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.service-item {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 12px;
    align-items: center;
}

.service-info {
    display: flex;
    flex-direction: column;
}

.service-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.service-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.service-bar {
    background: var(--bg-primary);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.service-progress {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.service-percentage {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

/* Analytics Bottom Row */
.analytics-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.list-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* Client List */
.client-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.client-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.client-row:hover {
    background: #E8F5E9;
}

.client-rank {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.client-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.client-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.client-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.client-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    gap: 12px;
    align-items: start;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 16px;
}

.activity-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.activity-title {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Responsive Analytics */
@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .analytics-bottom-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .service-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .service-bar {
        order: 3;
    }
    
    .service-percentage {
        text-align: left;
    }
}
