/* ==========================================================================
   Fusion Technician Portal - Mobile-First Styles (v2)
   ========================================================================== */

/* ---- Base & Mobile First ---- */
.tech-portal {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    max-width: 640px;
    margin: 0 auto;
}

/* ---- Quick Stats Bar (Dashboard) ---- */
.tech-stats-bar {
    display: flex;
    gap: 0.5rem;
}

.tech-stat-card {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.75rem 0.5rem;
    border-radius: 12px;
    text-align: center;
    color: #fff;
    font-weight: 600;
}
.tech-stat-card .stat-number {
    font-size: 1.5rem;
    line-height: 1.2;
}
.tech-stat-card .stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}
.tech-stat-total { background: linear-gradient(135deg, #5ba848, #3a8fb7); }
.tech-stat-remaining { background: linear-gradient(135deg, #3498db, #2980b9); }
.tech-stat-completed { background: linear-gradient(135deg, #27ae60, #219a52); }

/* ---- Clock In/Out Card ---- */
.tech-clock-card {
    background: var(--o-main-card-bg, #fff);
    border: 1px solid var(--o-main-border-color, #e9ecef);
    border-radius: 14px;
    padding: 0.875rem 1rem;
}
.tech-clock-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #adb5bd;
    flex-shrink: 0;
}
.tech-clock-dot--active {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
    animation: tech-clock-pulse 2s ease-in-out infinite;
}
@keyframes tech-clock-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
    50% { box-shadow: 0 0 12px rgba(16, 185, 129, 0.8); }
}
.tech-clock-status {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--o-main-text-color, #212529);
    line-height: 1.2;
}
.tech-clock-timer {
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #6c757d;
}
.tech-clock-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.tech-clock-btn:active { transform: scale(0.96); }
.tech-clock-btn--in {
    background: #10b981;
    color: #fff;
}
.tech-clock-btn--in:hover { background: #059669; }
.tech-clock-btn--out {
    background: #ef4444;
    color: #fff;
}
.tech-clock-btn--out:hover { background: #dc2626; }
.tech-clock-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.tech-clock-error {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ---- Quick Links (All Tasks / Tomorrow / Repair Form) ---- */
.tech-quick-links {
    display: flex;
    gap: 0.5rem;
}

.tech-quick-link {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.875rem 0.5rem;
    border-radius: 12px;
    border: 1.5px solid;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.15s;
    position: relative;
}
.tech-quick-link:active { transform: scale(0.97); }
.tech-quick-link i { font-size: 1.1rem; }

.tech-quick-link-primary {
    border-color: #3498db;
    color: #3498db !important;
    background: rgba(52, 152, 219, 0.04);
}
.tech-quick-link-primary:hover { background: rgba(52, 152, 219, 0.1); }

.tech-quick-link-secondary {
    border-color: #6c757d;
    color: #6c757d !important;
    background: rgba(108, 117, 125, 0.04);
}
.tech-quick-link-secondary:hover { background: rgba(108, 117, 125, 0.1); }

.tech-quick-link-warning {
    border-color: #e67e22;
    color: #e67e22 !important;
    background: rgba(230, 126, 34, 0.04);
}
.tech-quick-link-warning:hover { background: rgba(230, 126, 34, 0.1); }

.tech-quick-link-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #3498db;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 4px;
}

/* ---- Hero Card (Dashboard Current Task) ---- */
.tech-hero-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}
.tech-hero-card .card-header {
    background: linear-gradient(135deg, #5ba848 0%, #3a8fb7 60%, #2e7aad 100%);
    color: #fff;
    padding: 1rem 1.25rem;
    border: none;
}
.tech-hero-card .card-header h5 {
    color: #fff;
    margin: 0;
}
.tech-hero-card .card-body {
    padding: 1.25rem;
}
.tech-hero-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.85;
    margin-bottom: 0.15rem;
}

/* ---- Timeline (Dashboard) ---- */
.tech-timeline {
    position: relative;
    padding-left: 2rem;
}
.tech-timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

.tech-timeline-item {
    position: relative;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}
.tech-timeline-dot {
    position: absolute;
    left: -1.55rem;
    top: 0.35rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #dee2e6;
    z-index: 1;
}
.tech-timeline-dot.status-scheduled { background: #6c757d; box-shadow: 0 0 0 2px #6c757d; }
.tech-timeline-dot.status-en_route { background: #3498db; box-shadow: 0 0 0 2px #3498db; }
.tech-timeline-dot.status-in_progress { background: #f39c12; box-shadow: 0 0 0 2px #f39c12; animation: pulse-dot 1.5s infinite; }
.tech-timeline-dot.status-completed { background: #27ae60; box-shadow: 0 0 0 2px #27ae60; }
.tech-timeline-dot.status-cancelled { background: #e74c3c; box-shadow: 0 0 0 2px #e74c3c; }

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 2px #f39c12; }
    50% { box-shadow: 0 0 0 6px rgba(243, 156, 18, 0.3); }
}

.tech-timeline-card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 0.875rem 1rem;
    background: #fff;
    transition: box-shadow 0.2s, transform 0.15s;
    text-decoration: none !important;
    color: inherit !important;
    display: block;
}
.tech-timeline-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.tech-timeline-card.active {
    border-color: #f39c12;
    border-width: 2px;
    box-shadow: 0 4px 16px rgba(243, 156, 18, 0.15);
}

.tech-timeline-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
}
.tech-timeline-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
    margin: 0.15rem 0;
}
.tech-timeline-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Travel indicator between tasks */
.tech-travel-indicator {
    padding: 0.35rem 0 0.35rem 0;
    margin-left: -0.2rem;
    font-size: 0.75rem;
    color: #8e44ad;
}

/* ---- Task Type Badges ---- */
.tech-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tech-badge-delivery { background: #d4edda; color: #155724; }
.tech-badge-repair { background: #fff3cd; color: #856404; }
.tech-badge-pickup { background: #cce5ff; color: #004085; }
.tech-badge-troubleshoot { background: #f8d7da; color: #721c24; }
.tech-badge-assessment { background: #e2e3e5; color: #383d41; }
.tech-badge-installation { background: #d1ecf1; color: #0c5460; }
.tech-badge-maintenance { background: #e8daef; color: #6c3483; }
.tech-badge-other { background: #e9ecef; color: #495057; }

/* Status badges */
.tech-status-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.tech-status-scheduled { background: #e9ecef; color: #495057; }
.tech-status-en_route { background: #cce5ff; color: #004085; }
.tech-status-in_progress { background: #fff3cd; color: #856404; }
.tech-status-completed { background: #d4edda; color: #155724; }
.tech-status-cancelled { background: #f8d7da; color: #721c24; }

/* ==========================================================================
   Task Detail Page - v2 Redesign
   ========================================================================== */

/* ---- Back button ---- */
.tech-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--o-main-bg-color, #f8f9fa);
    color: var(--o-main-text-color, #495057);
    text-decoration: none !important;
    transition: background 0.15s;
    border: 1px solid var(--o-main-border-color, #dee2e6);
}
.tech-back-btn:hover {
    background: var(--o-main-border-color, #dee2e6);
}

/* ---- Task Hero Header ---- */
.tech-task-hero {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--o-main-border-color, #eee);
}

/* ---- Quick Actions Row ---- */
.tech-quick-actions {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 0.25rem 0;
}
.tech-quick-actions::-webkit-scrollbar { display: none; }

.tech-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 68px;
    padding: 0.6rem 0.5rem;
    border-radius: 14px;
    background: var(--o-main-bg-color, #f8f9fa);
    border: 1px solid var(--o-main-border-color, #e9ecef);
    color: var(--o-main-text-color, #495057) !important;
    text-decoration: none !important;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: all 0.15s;
    flex-shrink: 0;
}
.tech-quick-btn i {
    font-size: 1.15rem;
    color: #3498db;
}
.tech-quick-btn:hover {
    background: #e3f2fd;
    border-color: #90caf9;
}
.tech-quick-btn:active {
    transform: scale(0.95);
}

/* ---- Card (unified style for all sections) ---- */
.tech-card {
    background: var(--o-main-card-bg, #fff);
    border: 1px solid var(--o-main-border-color, #e9ecef);
    border-radius: 14px;
    padding: 1rem;
}
.tech-card-success {
    border-color: #c3e6cb;
    background: color-mix(in srgb, #d4edda 30%, var(--o-main-card-bg, #fff));
}

/* ---- Card icon (left gutter icon) ---- */
.tech-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* ---- Equipment highlight tag ---- */
.tech-equipment-tag {
    background: color-mix(in srgb, #ffeeba 25%, var(--o-main-card-bg, #fff));
    border: 1px solid #ffeeba;
    border-radius: 10px;
    padding: 0.75rem;
}

/* ---- Action Buttons (Large Touch Targets) ---- */
.tech-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none !important;
}
.tech-action-btn:active { transform: scale(0.97); }

.tech-btn-navigate {
    background: #3498db;
    color: #fff !important;
}
.tech-btn-navigate:hover { background: #2980b9; color: #fff !important; }

.tech-btn-start {
    background: #27ae60;
    color: #fff !important;
}
.tech-btn-start:hover { background: #219a52; color: #fff !important; }

.tech-btn-complete {
    background: #f39c12;
    color: #fff !important;
}
.tech-btn-complete:hover { background: #e67e22; color: #fff !important; }

.tech-btn-call {
    background: #9b59b6;
    color: #fff !important;
}
.tech-btn-call:hover { background: #8e44ad; color: #fff !important; }

.tech-btn-enroute {
    background: #2980b9;
    color: #fff !important;
}
.tech-btn-enroute:hover { background: #2471a3; color: #fff !important; }

/* ---- Bottom Action Bar (Fixed on mobile) ---- */
.tech-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--o-main-card-bg, #fff);
    border-top: 1px solid var(--o-main-border-color, #dee2e6);
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 1050;
    display: flex;
    gap: 0.5rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.tech-bottom-bar .tech-action-btn {
    flex: 1;
}

/* Padding to prevent content being hidden behind fixed bar */
.has-bottom-bar {
    padding-bottom: 5rem;
}

/* ---- Completion Overlay ---- */
.tech-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.tech-overlay-card {
    background: var(--o-main-card-bg, #fff);
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}
.tech-overlay-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Voice Recording UI ---- */
.tech-voice-recorder {
    border: 2px dashed var(--o-main-border-color, #dee2e6);
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all 0.3s;
}
.tech-voice-recorder.recording {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.04);
}

.tech-record-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: #e74c3c;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tech-record-btn:hover { transform: scale(1.05); }
.tech-record-btn:active { transform: scale(0.95); }
.tech-record-btn.recording {
    animation: pulse-record 1.5s infinite;
}

@keyframes pulse-record {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); }
}

.tech-record-timer {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-top: 0.5rem;
    color: #e74c3c;
}

/* ---- Tomorrow Prep ---- */
.tech-prep-card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #fff;
}
.tech-prep-card .prep-time {
    font-weight: 700;
    font-size: 0.9rem;
}
.tech-prep-card .prep-type {
    margin-left: 0.5rem;
}
.tech-prep-equipment {
    background: #fff9e6;
    border: 1px solid #ffeeba;
    border-radius: 12px;
    padding: 1rem;
}

/* ---- Responsive: Desktop enhancements ---- */
@media (min-width: 768px) {
    .tech-stats-bar {
        gap: 1rem;
    }
    .tech-stat-card {
        padding: 1rem 1.5rem;
    }
    .tech-stat-card .stat-number {
        font-size: 2rem;
    }
    .tech-quick-links {
        gap: 1rem;
    }
    .tech-quick-link {
        padding: 1rem 0.75rem;
        font-size: 0.85rem;
    }
    .tech-bottom-bar {
        position: static;
        box-shadow: none;
        border: none;
        padding: 0;
        margin-top: 1rem;
    }
    .has-bottom-bar {
        padding-bottom: 0;
    }
    .tech-timeline {
        padding-left: 3rem;
    }
    .tech-timeline::before {
        left: 1.25rem;
    }
    .tech-timeline-dot {
        left: -2.05rem;
    }
    .tech-quick-btn {
        min-width: 80px;
        padding: 0.75rem 0.75rem;
    }
}

/* ---- Legacy detail section support ---- */
.tech-detail-section {
    background: var(--o-main-card-bg, #fff);
    border: 1px solid var(--o-main-border-color, #e9ecef);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.tech-detail-section h6 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--o-main-border-color, #f1f3f5);
}
.tech-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
}
.tech-detail-label {
    font-weight: 500;
    color: var(--o-main-text-color, #495057);
    font-size: 0.9rem;
}
.tech-detail-value {
    color: var(--o-main-text-color, #212529);
    font-size: 0.9rem;
    text-align: right;
}
