/* Mark Attendance page. Scoped under .ma-page - see FieldDashboard.css /
   TasksAllocation.css for why every selector here is prefixed (this
   stylesheet loads globally alongside every other page's). */

.ma-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1f2937;
}

.ma-title {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
}

.ma-subtitle {
    margin: 0 0 20px;
    font-size: 0.92rem;
    color: #6b7280;
}

.ma-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.ma-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
}

.ma-meta {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #6b7280;
}

/* ---------- Form (left card) ---------- */
.ma-late-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fef3e2;
    border: 1px solid #fde68a;
    color: #92400e;
    font-weight: 600;
    font-size: 0.88rem;
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.25rem;
}

.ma-field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #111827;
    margin: 1rem 0 6px;
}

    .ma-field-label:first-of-type {
        margin-top: 0;
    }

.ma-required {
    color: #dc2626;
    margin-left: 2px;
}

.ma-input {
    width: 100%;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    font-size: 0.92rem;
    color: #111827;
    outline: none;
}

    .ma-input:focus {
        border-color: #15803d;
    }

.ma-location-row {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #15803d;
    font-weight: 600;
    font-size: 0.88rem;
    margin: 14px 0 1.5rem;
}

.ma-link-btn {
    background: none;
    border: none;
    padding: 0;
    color: #15803d;
    font-weight: 700;
    font-size: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.ma-btn-submit {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #15803d;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.85rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
}

    .ma-btn-submit:hover:not(:disabled) {
        background: #166534;
    }

    .ma-btn-submit:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* ---------- Post-stop success state (left card) ---------- */
.ma-success-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.ma-success-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #15803d;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.ma-success-text {
    flex: 1 1 auto;
    min-width: 0;
}

.ma-success-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ma-success-title {
    font-weight: 700;
    font-size: 0.98rem;
    color: #15803d;
}

.ma-success-time {
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.ma-success-sub {
    margin-top: 4px;
    font-size: 0.85rem;
    color: #6b7280;
}

.ma-stats-row {
    display: flex;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 1.25rem 1rem;
    margin-bottom: 1.5rem;
}

.ma-stat {
    flex: 1 1 0;
    text-align: center;
}

    .ma-stat:not(:last-child) {
        border-right: 1px solid #e5e7eb;
    }

.ma-stat-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #15803d;
    font-size: 1rem;
    margin-bottom: 6px;
}

.ma-stat-pct {
    font-size: 1.3rem;
    font-weight: 700;
}

.ma-stat-label {
    font-size: 0.85rem;
    color: #374151;
    font-weight: 600;
}

/* ---------- Tracking details view (full-width, no side card) ---------- */
.ma-tracking-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.1rem 1.4rem 1.4rem;
}

.ma-tracking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 1.1rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid #f1f5f9;
}

.ma-tracking-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.ma-tracking-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1b5e20;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.ma-tracking-title {
    font-weight: 600;
    font-size: 1rem;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ma-tracking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
}

.ma-tracking-sub {
    font-size: 0.82rem;
    color: #6b7280;
    margin-top: 2px;
}

.ma-tracking-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.ma-btn-stop {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 0.55rem 1.1rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

    .ma-btn-stop:hover {
        background: #b91c1c;
    }

.ma-timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #111827;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    border-radius: 20px;
    padding: 0.5rem 0.9rem;
}

.ma-map {
    position: relative;
    min-height: 420px;
    border-radius: 10px;
    overflow: hidden;
    background:
        radial-gradient(circle at 78% 30%, #d9f0da 0%, #d9f0da 7%, transparent 7.5%),
        radial-gradient(circle at 92% 55%, #d9f0da 0%, #d9f0da 9%, transparent 9.5%),
        radial-gradient(circle at 58% 78%, #d9f0da 0%, #d9f0da 10%, transparent 10.5%),
        radial-gradient(circle at 25% 20%, #d9f0da 0%, #d9f0da 8%, transparent 8.5%),
        linear-gradient(100deg, transparent 32%, #fde6ad 32%, #fde6ad 34%, transparent 34%),
        linear-gradient(10deg, transparent 58%, #fde6ad 58%, #fde6ad 60%, transparent 60%),
        linear-gradient(100deg, #bfdbfe 0%, #bfdbfe 16%, #eef4ee 17%, #eef4ee 100%);
}

.ma-map-route-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

    .ma-map-route-svg path {
        fill: none;
        stroke: #3b82f6;
        stroke-width: 7;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

.ma-map-pin-start {
    position: absolute;
    left: 12%;
    bottom: 18%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, 50%);
    border-radius: 50%;
    background: #3b82f6;
    border: 4px solid #fff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0.18), 0 2px 6px rgba(0, 0, 0, 0.25);
}

.ma-map-pin-end {
    position: absolute;
    top: 20%;
    left: 76%;
    width: 34px;
    height: 34px;
    transform: translate(-50%, -100%) rotate(45deg);
    border-radius: 50% 50% 50% 0;
    background: #16a34a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

    .ma-map-pin-end i {
        transform: rotate(-45deg);
    }

.ma-map-label {
    position: absolute;
    left: 15%;
    bottom: 40%;
    background: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1d4ed8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.ma-map-zoom {
    position: absolute;
    right: 16px;
    bottom: 64px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
}

    .ma-map-zoom button {
        width: 36px;
        height: 36px;
        background: #fff;
        border: none;
        color: #111827;
        cursor: pointer;
    }

    .ma-map-zoom button:first-child {
        border-bottom: 1px solid #e5e7eb;
    }

    .ma-map-zoom button:hover {
        background: #f9fafb;
    }

.ma-map-locate {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #fff;
    border: none;
    color: #111827;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
}

    .ma-map-locate:hover {
        background: #f9fafb;
    }

/* ---------- Profile summary (right card) ---------- */
.ma-profile-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 1.1rem;
}

.ma-role-badge {
    flex-shrink: 0;
    background: #15803d;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 20px;
    padding: 6px 16px;
}

.ma-profile-name {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #111827;
}

.ma-info-rows {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-bottom: 1.25rem;
}

.ma-info-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    font-size: 0.95rem;
}

.ma-info-key {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
}

.ma-info-val {
    font-weight: 600;
    color: #111827;
    text-align: right;
}

.ma-info-val-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.ma-info-sub {
    font-size: 0.8rem;
    font-weight: 500;
    color: #9ca3af;
}

.ma-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    margin-right: 6px;
}

.ma-dot-off {
    background: #ea8c2e;
}

.ma-weekly-title {
    margin: 0 0 0.9rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    border-top: 1px solid #e5e7eb;
    padding-top: 1.1rem;
}

.ma-weekly-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.ma-weekly-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: #374151;
    flex-wrap: wrap;
}

.ma-weekly-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #16a34a;
}

.ma-weekly-day {
    min-width: 150px;
    font-weight: 600;
    color: #111827;
}

.ma-weekly-sep {
    color: #9ca3af;
}

.ma-weekly-km {
    margin-left: auto;
    font-weight: 600;
    color: #111827;
}

/* ---------- Tablet (768px - 1199.98px) ---------- */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .ma-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Phone (<= 767.98px) ---------- */
@media (max-width: 767.98px) {
    .ma-page {
        padding-top: 12px !important;
        padding-bottom: calc(16px + var(--safe-bottom, 0px)) !important;
    }

    .ma-title {
        font-size: 1.25rem;
    }

    .ma-grid {
        grid-template-columns: 1fr;
    }

    .ma-card {
        padding: 1.1rem 1.1rem;
    }

    .ma-input,
    .ma-link-btn {
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .ma-btn-submit {
        min-height: 44px;
    }

    .ma-info-row {
        flex-direction: column;
        gap: 4px;
    }

    .ma-info-val,
    .ma-info-val-stack {
        text-align: left;
        align-items: flex-start;
    }

    .ma-weekly-day {
        min-width: 0;
        flex-basis: 100%;
    }

    .ma-weekly-km {
        margin-left: 20px;
    }

    .ma-success-banner {
        flex-direction: column;
    }

    .ma-success-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .ma-stats-row {
        flex-direction: column;
        gap: 1rem;
    }

    .ma-stat:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding-bottom: 1rem;
    }

    .ma-tracking-card {
        padding: 1rem 1.1rem 1.1rem;
    }

    .ma-tracking-actions {
        width: 100%;
        justify-content: space-between;
    }

    .ma-btn-stop,
    .ma-timer-badge {
        min-height: 44px;
    }

    .ma-map {
        min-height: 300px;
    }

    .ma-map-zoom,
    .ma-map-locate {
        right: 10px;
    }
}

@media (max-width: 420px) {
    .ma-weekly-row {
        gap: 6px;
    }
}
