/* My Schedule - Mobile First */

/* ========== Tab Navigation ========== */
/* Same shape as the Inspections and Services tab navs, including their icon-only
   treatment under 480px. Two tabs fit a phone with their labels; "Today's Schedule",
   "Today's Map" and "Library" do not, so below that width the labels drop and the
   three icons split the bar — the same rule .tab-label carries everywhere else in
   the field app. The Library tab is only present for a tech who has folder grants,
   so on a phone this bar is two labelled tabs or three icons, never a wrap. */

.dashboard-tabs {
    display: flex;
    gap: 0;
    background: #ffffff;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-button {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.2s;
    text-decoration: none;
    margin-bottom: -2px;
}

.tab-button * { pointer-events: none; }
.tab-button:hover { color: #059669; background: #f8fafc; }
.tab-button.active { color: #059669; border-bottom-color: #059669; background: transparent; }
.tab-button i { font-size: 16px; }

@media (max-width: 479px) {
    .dashboard-tabs { justify-content: center; padding: 0; overflow-x: visible; }
    .tab-button { flex: 1; justify-content: center; padding: 12px 8px; font-size: 13px; }
    .tab-label { display: none; }
    /* With the label gone the icon is the entire target, so give it back the size
       the text was carrying. */
    .tab-button i { font-size: 18px; }
}

/* ========== Map Tab ========== */

/* The map fills what is left below the header, tab bar and date nav. Fixed
   viewport maths rather than a percentage: every ancestor here is auto-height,
   so a percentage height collapses the canvas to nothing and Google renders a
   grey strip. 214px is header (74) + tabs (46) + date nav (57) + footer nav (37). */
.map-canvas {
    width: 100%;
    height: calc(100vh - 214px);
    min-height: 320px;
    background: #e2e8f0;
}

.map-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 16px;
    border-bottom: 1px solid #fde68a;
}

.map-unavailable {
    padding: 48px 24px;
    text-align: center;
}

/* Info window: Google supplies the bubble, so this only styles what goes inside it. */
.map-pin-info {
    font-family: 'DM Sans', sans-serif;
    min-width: 180px;
    max-width: 240px;
}

.map-pin-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 2px 0;
}

.map-pin-ref {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}

/* The badge is inline-block and carries only a top margin on a card, where the
   details below it supply their own spacing. In the bubble it needs to clear the
   rows that follow. */
.map-pin-info .job-type-badge {
    margin-bottom: 8px;
}

.map-pin-info .job-type-row {
    margin: 0 0 8px;
}

.map-pin-info .job-type-row .job-type-badge {
    margin-bottom: 0;
}

.map-pin-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: #475569;
    margin-bottom: 4px;
}

.map-pin-row i {
    color: #94a3b8;
    margin-top: 2px;
}

.map-pin-open {
    display: inline-block;
    margin-top: 8px;
    background: #059669;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.map-pin-open:active { background: #047857; }

/* ========== Page Header ========== */

.page-header {
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
    padding: 20px 16px;
    margin-bottom: 0;
}

.page-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.page-header-icon {
    font-size: 24px;
    opacity: 0.9;
}

.job-count-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* ========== Date Navigation ========== */

.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.date-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.date-nav-btn:active {
    transform: scale(0.93);
    background: #f1f5f9;
}

.date-nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.date-nav-label {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.date-nav-today {
    border: none;
    background: none;
    color: #059669;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.date-nav-today:active {
    opacity: 0.7;
}

/* ========== Dashboard Content ========== */

.dashboard-content {
    padding: 16px;
}

/* ========== Greeting Card ========== */

.greeting-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.greeting-text {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.greeting-hello {
    font-size: 16px;
    color: #64748b;
    font-weight: 500;
}

.greeting-name {
    font-size: 16px;
    color: #1e293b;
    font-weight: 700;
}

/* ========== Schedule Section ========== */

.schedule-section {
    margin-bottom: 24px;
}

.schedule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.schedule-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.refresh-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: #f8fafc;
    color: #059669;
    border-color: #059669;
}

.refresh-btn:active {
    transform: scale(0.95);
}

.refresh-btn.spinning i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Loading State ========== */

.schedule-loading {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loading-pulse {
    background: #e2e8f0;
    border-radius: 12px;
    height: 100px;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-pulse:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-pulse:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ========== Empty State ========== */

.schedule-empty {
    text-align: center;
    padding: 48px 24px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.empty-icon {
    width: 64px;
    height: 64px;
    background: #d1fae5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: #059669;
}

.empty-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
}

.empty-description {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* ========== Job Cards ========== */

.job-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.job-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.job-card:active {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.job-card-accent {
    height: 4px;
    background: #059669;
}

.job-card-accent.priority-high {
    background: #dc2626;
}

.job-card-accent.priority-medium {
    background: #d97706;
}

.job-card-accent.priority-low {
    background: #059669;
}

.job-card-accent.priority-urgent {
    background: #7c2d12;
}

.job-card-body {
    padding: 16px;
}

.job-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
}

.job-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

.job-card-ref {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 2px;
}

.job-status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.job-status-badge.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.job-status-badge.status-scheduled {
    background: #dbeafe;
    color: #1e40af;
}

.job-status-badge.status-in-progress {
    background: #d1fae5;
    color: #065f46;
}

.job-status-badge.status-completed {
    background: #f0fdf4;
    color: #166534;
}

.job-status-badge.status-on-hold {
    background: #fee2e2;
    color: #991b1b;
}

.job-status-badge.status-cancelled {
    background: #f1f5f9;
    color: #475569;
}

.job-card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.job-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
}

.job-detail-row i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
}

.job-detail-row .detail-value {
    font-weight: 500;
    color: #475569;
}

.job-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

.job-time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #059669;
}

.job-time i {
    font-size: 12px;
}

.job-duration {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.job-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.job-attribute-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
}

/* ========== Completed Card (compact) ========== */

.job-card-completed {
    opacity: 0.6;
}

.job-card-completed .job-card-body {
    padding: 12px 16px;
}

.job-card-completed .job-card-top {
    margin-bottom: 0;
}

/* ========== Schedule Group Labels (Past Due / Today) ========== */

.schedule-group-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 4px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.schedule-group-label.schedule-group-pastdue {
    color: #b91c1c;
}

/* First label shouldn't add extra top space above the list. */
#jobCards > .schedule-group-label:first-child {
    padding-top: 4px;
}

/* Past-due "N days overdue" row inside the card. */
.job-detail-row.job-detail-overdue .detail-value {
    color: #b91c1c;
    font-weight: 600;
}

.job-detail-row.job-detail-overdue i {
    color: #dc2626;
}

/* ========== Type Badge ========== */

.job-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    margin-top: 4px;
}

.job-type-badge.type-inspection {
    background: #dbeafe;
    color: #1e40af;
}

.job-type-badge.type-service {
    background: #ffedd5;
    color: #9a3412;
}

.job-type-badge.type-task {
    background: #ede9fe;
    color: #5b21b6;
}

/* Job type + scope chips on one wrapping line under the title. */
.job-type-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.job-type-row .job-type-badge {
    margin-top: 0;
}

.job-scope-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    background: #f1f5f9;
    color: #475569;
}

.job-scope-freq {
    color: #64748b;
    font-weight: 500;
}

.job-scope-freq::before {
    content: "\00b7";
    margin-right: 5px;
    color: #94a3b8;
}

/* ========== Address Link ========== */

.address-link {
    color: #059669;
    text-decoration: none;
    font-weight: 600;
}

.address-link:hover {
    text-decoration: underline;
    color: #047857;
}

/* ========== Scale Up: Larger screens ========== */

@media (min-width: 480px) {
    .dashboard-content {
        padding: 20px;
    }

    .page-header {
        padding: 24px 20px;
    }

    .page-header-title {
        font-size: 20px;
    }

    .job-card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
}
