/* Prevent iOS zoom on double-tap */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
/* Add this new rule right after: */
/* *:not(.container):not(.modal-content) {
    max-width: 100vw !important;
}*


/* Keep your original html/body rules but add these specific fixes */
html, body {
    min-height: 100vh;
    overflow-x: hidden !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    min-height: 100vh;
    color: #333;
    touch-action: pan-x pan-y;
    width: 100%;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
}

/* More aggressive container locking */
.container {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-top: 50px;
    overflow: hidden; /* Prevent content overflow */
    transform: translateX(0); /* Lock horizontal position */
    min-width: 320px; /* Prevent shrinking on small screens */
    position: relative;
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

/* Logo Styles */
.proximity-logo {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    padding: 16px 24px;
    border-radius: 12px;
    gap: 16px;
    margin-bottom: 10px;
}

.logo-circles {
    position: relative;
    width: 40px;
    height: 24px;
}

.logo-circle {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.circle1 {
    background: radial-gradient(circle at 30% 30%, #f8f9fa 0%, #e9ecef 40%, #dee2e6 100%);
    opacity: 0.9;
    left: 0;
}

.circle2 {
    background: radial-gradient(circle at 30% 30%, #e9ecef 0%, #ced4da 40%, #adb5bd 100%);
    opacity: 0.8;
    left: 12px;
}

.logo-text {
    font-size: 24px;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #6c757d;
    font-size: 14px;
}

/* Fixed Status Message Area */
.fixed-status-area {
    min-height: 50px;
    max-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    overflow: hidden;
}

.status-message {
    font-size: 14px;
    color: #1a365d;
    font-weight: 500;
    text-align: center;
    padding: 0 15px;
    transition: all 0.3s ease;
}

.status-message.success {
    color: #28a745;
}

.status-message.error {
    color: #dc3545;
}

.status-message.info {
    color: #17a2b8;
}

.status-message.warning {
    color: #ffc107;
}

.status-message.offline {
    color: #dc3545;
    font-weight: 600;
}

.status-message.online {
    color: #28a745;
    font-weight: 600;
}

.status-message.syncing {
    color: #17a2b8;
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-message.location {
    color: #6c757d;
    font-weight: 500;
    font-style: italic;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.location-display {
    background: #f0f4f8;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.location-title {
    font-size: 12px;
    color: #1a365d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.location-value {
    font-size: 16px;
    color: #1a365d;
    font-weight: 600;
    word-break: break-word; /* Prevent text overflow */
    overflow-wrap: break-word;
    max-width: 100%;
}

.settings-group {
    margin-bottom: 25px;
}

.settings-label {
    font-size: 14px;
    color: #1a365d;
    margin-bottom: 15px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    font-weight: 600;
}

/* Distance Display Window */
.distance-display {
    background: #f0f4f8;
    border: 2px solid #1a365d;
    border-radius: 8px;
    padding: 10px 20px;
    margin: 0 auto 15px;
    width: 200px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #1a365d;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.distance-display.active {
    background: #1a365d;
    color: white;
}

/* Database Toggle Styles */
.database-toggle {
    width: 100%;
    padding: 15px;
    background: #f0f4f8;
    border: 2px solid #1a365d;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.database-toggle:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.2);
}

.database-toggle:active {
    transform: translateY(0);
}

.db-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a365d;
}

.db-indicator {
    color: #1a365d;
    font-size: 20px;
    transition: transform 0.3s ease;
}

.database-toggle:hover .db-indicator {
    transform: translateX(5px);
}

/* Locations List */
.locations-list {
    margin-top: 30px;
    max-width: 100%; /* Prevent overflow */
    overflow-x: hidden;
}

.locations-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1a365d;
}

.location-item {
    background: #f0f4f8;
    border-left: 4px solid #1a365d;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    max-width: 100%; /* Prevent overflow */
    overflow-x: hidden;
}

.location-item:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.location-name {
    font-weight: 600;
    color: #1a365d;
    margin-bottom: 5px;
    word-break: break-word; /* Prevent text overflow */
    overflow-wrap: break-word;
    max-width: 100%;
}

.location-address {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 5px;
    word-break: break-word; /* Prevent text overflow */
    overflow-wrap: break-word;
    max-width: 100%;
}

.location-distance {
    font-size: 14px;
    color: #2c5aa0;
    font-weight: 600;
}

.location-details-hint {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

/* Clock Faces */
.clock-container {
    display: flex;
    justify-content: space-around;
    margin-bottom: 25px;
}

.clock-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.clock-face {
    width: 60px;
    height: 60px;
    border: 3px solid #1a365d;
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
    background: white;
}

.clock-face:hover {
    transform: scale(1.1);
    border-color: #2c5aa0;
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.2);
}

.clock-face.selected {
    background: #1a365d;
    border-color: #1a365d;
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(26, 54, 93, 0.4);
}

.clock-center {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #1a365d;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.clock-face.selected .clock-center {
    background: white;
}

.clock-hand {
    position: absolute;
    background: #1a365d;
    transform-origin: bottom center;
    left: 50%;
    bottom: 50%;
}

.clock-face.selected .clock-hand {
    background: white;
}

.hour-hand {
    width: 3px;
    height: 15px;
    margin-left: -1.5px;
}

.minute-hand {
    width: 2px;
    height: 20px;
    margin-left: -1px;
}

.clock-label {
    text-align: center;
    margin-top: 5px;
    font-size: 11px;
    color: #6c757d;
}

.clock-wrapper.selected .clock-label {
    color: #1a365d;
    font-weight: bold;
}

/* Concentric Rings */
.rings-container {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto;
}

.distance-ring {
    position: absolute;
    border-radius: 50%;
    border: 4px solid #1a365d;
    cursor: pointer;
    transition: all 0.3s ease;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
}

.distance-ring:hover {
    border-width: 5px;
    border-color: #1a365d;
    box-shadow: 0 0 15px rgba(26, 54, 93, 0.3);
}

.distance-ring.selected {
    border-width: 6px;
    border-color: #1a365d;
}

.ring-1 {
    width: 80px;
    height: 80px;
    z-index: 5;
}

.ring-1.selected {
    background: #1a365d;
}

.ring-2 {
    width: 140px;
    height: 140px;
    z-index: 4;
}

.ring-2.selected {
    background: #1a365d;
    -webkit-mask-image: radial-gradient(circle at center, transparent 0, transparent 34px, black 34px);
    mask-image: radial-gradient(circle at center, transparent 0, transparent 34px, black 34px);
}

.ring-3 {
    width: 200px;
    height: 200px;
    z-index: 3;
}

.ring-3.selected {
    background: #1a365d;
    -webkit-mask-image: radial-gradient(circle at center, transparent 0, transparent 64px, black 64px);
    mask-image: radial-gradient(circle at center, transparent 0, transparent 64px, black 64px);
}

.ring-4 {
    width: 260px;
    height: 260px;
    z-index: 2;
}

.ring-4.selected {
    background: #1a365d;
    -webkit-mask-image: radial-gradient(circle at center, transparent 0, transparent 94px, black 94px);
    mask-image: radial-gradient(circle at center, transparent 0, transparent 94px, black 94px);
}

.ring-5 {
    width: 320px;
    height: 320px;
    z-index: 1;
}

.ring-5.selected {
    background: #1a365d;
    -webkit-mask-image: radial-gradient(circle at center, transparent 0, transparent 124px, black 124px);
    mask-image: radial-gradient(circle at center, transparent 0, transparent 124px, black 124px);
}

/* Crosshair */
.crosshair {
    position: absolute;
    width: 30px;
    height: 30px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background: #1a365d;
    opacity: 0.5;
}

.crosshair::before {
    width: 2px;
    height: 30px;
    left: 50%;
    transform: translateX(-50%);
}

.crosshair::after {
    width: 30px;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    max-width: 100%;
}

.btn-primary {
    background: #1a365d;
    color: white;
}

.btn-primary:hover {
    background: #2c5aa0;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(26, 54, 93, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Add Project Button */
.btn-add-project {
    background: #28a745;
    color: white;
}

.btn-add-project:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(40, 167, 69, 0.4);
}

.location-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn-navigate {
    padding: 8px 16px;
    background: #1a365d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    flex: 0 0 auto;
    min-width: 100px;
}

.btn-navigate:hover {
    background: #2c5aa0;
    transform: translateY(-2px);
}

.btn-share {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 100px;
}

.btn-share:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

/* Status Messages */
.status {
    padding: 10px;
    border-radius: 8px;
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
    display: none;
    max-width: 100%;
    overflow-x: hidden;
}

.status.show {
    display: block;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading.show {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1a365d;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
    margin: 0 auto;
}

/* Mobile: slightly narrower */
@media (max-width: 480px) {
    .modal-content {
        max-width: calc(100vw - 40px);
        border-radius: 15px 15px 0 0;
    }
}

/* Desktop: constrain to container width */
@media (min-width: 481px) {
    .modal-content {
        max-width: 450px; /* Matches your container max-width */
        width: 90%;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #f0f4f8;
}

.modal-header h2 {
    color: #1a365d;
    margin: 0;
    font-size: 24px;
}

.close-modal {
    font-size: 32px;
    font-weight: bold;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #1a365d;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px 25px;
    border-top: 2px solid #f0f4f8;
    justify-content: flex-end;
}

/* Classification Modal Specific Styles */
.classify-modal-content {
    max-width: 360px;
}

.contractor-info {
    margin-bottom: 20px;
    text-align: center;
}

.contractor-info h3 {
    color: #1a365d;
    margin: 0 0 8px 0;
    font-size: 18px;
}

.contractor-info p {
    color: #6c757d;
    margin: 0;
    font-size: 13px;
}

.classification-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-classify {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    text-align: center;
}

.btn-classify:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}

.btn-classify.ibew {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.btn-classify.ibew:hover {
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.4);
}

.btn-classify.ubcja {
    background: linear-gradient(135deg, #92400e 0%, #f59e0b 100%);
}

.btn-classify.ubcja:hover {
    box-shadow: 0 4px 15px rgba(146, 64, 14, 0.4);
}

.btn-classify.nonunion {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
}

.btn-classify.nonunion:hover {
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.4);
}

/* Classification Badge Styles (for location cards) */
.classification-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: white;
    border: none;
    cursor: default;
}

.classification-badge.ibew {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.classification-badge.ubcja {
    background: linear-gradient(135deg, #92400e 0%, #f59e0b 100%);
}

.classification-badge.nonunion {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
}

.btn-classify-contractor {
    background: #10b981;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-classify-contractor:hover {
    background: #059669;
    transform: translateY(-2px);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #1a365d;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px; /* Prevents iOS zoom */
    transition: border-color 0.3s ease;
    max-width: 100%;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #1a365d;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.required {
    color: #dc3545;
}

.form-note {
    color: #6c757d;
    font-size: 12px;
    margin-top: 10px;
}

.location-helper {
    margin: 15px 0;
    text-align: center;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    margin-top: 8px;
    width: 100%;
}

/* Clean button row styling - scoped properly */
div.button-row {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

div.button-row .btn-add-project {
    flex: 1;
}

div.button-row .help-button {
    flex: 0 0 auto;
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    white-space: nowrap;
}

div.button-row .help-button:hover {
    background: #2c5aa0;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(26, 54, 93, 0.4);
}

div.button-row .btn-settings {
    flex: 0 0 auto;
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    min-width: 50px;
}

div.button-row .btn-settings:hover {
    background: #2c5aa0;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(26, 54, 93, 0.4);
}

/* Blitz Button and alert toggle */
.btn-blitz {
    margin-top: 10px;
    margin-bottom: 18px;
    padding: 12px 24px;
    background: #ff9800;
    color: #fff;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.btn-blitz:hover {
    background: #fb8c00;
}

.btn-next-5 {
    margin-bottom: 18px;
    padding: 12px 24px;
    background: #2196f3;
    color: #fff;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.btn-next-5:hover {
    background: #1976d2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.btn-next-5:active {
    transform: translateY(0);
}

.btn-reset-view {
    margin-bottom: 18px;
    padding: 12px 24px;
    background: #6c757d;
    color: #fff;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.btn-reset-view:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.btn-reset-view:active {
    transform: translateY(0);
}

.pagination-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.pagination-buttons button {
    margin-bottom: 0;
    flex: 1;
}

/* Container for both toggles - stacked vertically */
.toggles-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 15px 0;
}

#notification-toggle-container,
#alert-mode-container {
    text-align: center;
}

.notification-toggle-label,
.alert-toggle-label {
    font-size: 14px;
    color: #1a365d;
    font-weight: 600;
    margin-bottom: 8px;
}

.notification-toggle-wrapper,
.alert-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

/* Fixed-width labels for perfect alignment */
.notification-toggle-wrapper span,
.alert-toggle-wrapper span {
    width: 80px;
    text-align: center;
}

/* Left label aligns right */
.notification-toggle-wrapper span:first-child,
.alert-toggle-wrapper span:first-child {
    text-align: right;
}

/* Right label aligns left */
.notification-toggle-wrapper span:last-child,
.alert-toggle-wrapper span:last-child {
    text-align: left;
}

.notification-toggle-switch,
.alert-toggle-switch {
    position: relative;
    width: 60px;
    height: 32px;
    background: #ccc;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.notification-toggle-switch.active,
.alert-toggle-switch.active {
    background: #1a365d;
}

.notification-toggle-thumb,
.alert-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.notification-toggle-switch.active .notification-toggle-thumb,
.alert-toggle-switch.active .alert-toggle-thumb {
    transform: translateX(28px);
}

/* Prevent PWA layout shifts */
#app-container {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
    overflow-x: hidden;
}

.main-content {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Fix for tracking/search dynamic content */
.search-container, .location-list, .tracking-display {
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

/* Prevent text overflow that might cause the slop */
.value, .contractor-name, .address {
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Contractor filter input */
#contractor-filter {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px; /* Prevents iOS zoom */
    max-width: 100%;
    box-sizing: border-box;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .container {
        margin-top: 20px;
        border-radius: 0;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .market-intelligence {
        max-width: 100vw;
        border-radius: 0;
        margin-top: 0;
        margin-bottom: 0;
        margin-left: 0;
        margin-right: 0;
        overflow-x: hidden;
    }

    .rings-container {
        width: 280px;
        height: 280px;
    }
    
    .ring-1 { width: 70px; height: 70px; }
    
    .ring-2 {
        width: 122.5px;
        height: 122.5px;
    }
    .ring-2.selected {
        -webkit-mask-image: radial-gradient(circle at center, transparent 0, transparent 29.75px, black 29.75px);
        mask-image: radial-gradient(circle at center, transparent 0, transparent 29.75px, black 29.75px);
    }

    .ring-3 {
        width: 175px;
        height: 175px;
    }
    .ring-3.selected {
        -webkit-mask-image: radial-gradient(circle at center, transparent 0, transparent 56px, black 56px);
        mask-image: radial-gradient(circle at center, transparent 0, transparent 56px, black 56px);
    }

    .ring-4 {
        width: 227.5px;
        height: 227.5px;
    }
    .ring-4.selected {
        -webkit-mask-image: radial-gradient(circle at center, transparent 0, transparent 82.25px, black 82.25px);
        mask-image: radial-gradient(circle at center, transparent 0, transparent 82.25px, black 82.25px);
    }
    
    .ring-5 {
        width: 280px;
        height: 280px;
    }
    .ring-5.selected {
        -webkit-mask-image: radial-gradient(circle at center, transparent 0, transparent 108.5px, black 108.5px);
        mask-image: radial-gradient(circle at center, transparent 0, transparent 108.5px, black 108.5px);
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* WITH THIS (for smartphone feel on desktop): */
@media (min-width: 769px) {
    .container {
        max-width: 450px;
        margin: 50px auto;
        box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    }

    .market-intelligence {
        max-width: 450px; /* EXACT same as .container */
        box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    }
}

/* Additional viewport fixes for dynamic content */
.locations-container, #locations-container {
    max-width: 100%;
    overflow-x: hidden;
}

/* Final safety net for horizontal overflow */
/* body * {
    max-width: 100vw !important;
}
*/

/* Lock down the main content area */
#app, #app-container, .main-content {
    overflow-x: hidden !important;
    max-width: 100vw;
    width: 100%;
}

/* Target dynamic content specifically */
.locations-list, .location-item, #locations-container {
    overflow-x: hidden !important;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Force text wrapping on dynamic content */
.location-name, .location-address, .contractor-name, .address {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    max-width: 100% !important;
}

/* Nuclear option for any remaining overflow - exclude container */
/* *:not(.container) {
    max-width: 100vw !important;
    box-sizing: border-box !important;
}
*/

/* Targeted box-sizing fixes for overflow prevention */
.location-item, .location-name, .location-address, 
#contractor-filter, .value, .contractor-name, .address {
    box-sizing: border-box !important;
}

/* Fix for contractor filter causing horizontal slop */
#contractor-filter {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px !important;
    margin: 10px 0 !important;
    border: 1px solid #ccc !important;
    border-radius: 8px !important;
    font-size: 16px !important; /* Prevents iOS zoom */
    box-sizing: border-box !important; /* This is key */
    overflow: hidden !important;
    word-wrap: break-word !important;
}

/* Also lock down its parent container */
.locations-list {
    overflow-x: hidden !important;
    max-width: 100% !important;
}
/* Clear filter button styling - match Blitz button exactly */
#clear-filter-btn {
    margin-bottom: 8px !important;  /* Small gap between clear and blitz */
    padding: 12px 24px !important;  /* Same as Blitz button */
    background: #6c757d !important;
    color: #fff !important;
    font-size: 16px !important;     /* Same as Blitz button */
    border: none !important;
    border-radius: 6px !important;  /* Same as Blitz button */
    font-weight: 600 !important;    /* Same as Blitz button */
    cursor: pointer !important;
    width: 100% !important;
    transition: all 0.3s ease !important;
    margin-top: 5px !important;     /* Reduce gap from search box */
}

#clear-filter-btn:hover {
    background: #5a6268 !important;
}

/* Campaign button - matches clear button exactly */
#start-campaign-btn {
    margin-bottom: 8px !important;
    padding: 12px 24px !important;
    background: #6c757d !important;
    color: #fff !important;
    font-size: 16px !important;
    border: none !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    width: 100% !important;
    transition: all 0.3s ease !important;
    margin-top: 5px !important;
}

#start-campaign-btn:hover {
    background: #5a6268 !important;
}

/* Prevent bounce during dynamic updates */
.container {
    min-height: 600px;  /* Set a minimum height to prevent expansion/contraction */
}

#current-location,
#status,
#locations-container {
    min-height: 24px;   /* Reserve space for these dynamic elements */
    transition: none;   /* Disable transitions during rapid updates */
}

/* Prevent loading spinner from affecting layout */
#loading {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

/* Add scale button - JK */

.scale-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #1a365d;
    color: white;
    border: 3px solid white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(26, 54, 93, 0.3);
}

.scale-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(26, 54, 93, 0.5);
}

.scale-button:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Full-Screen Proximity Alert Overlay */
.proximity-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.proximity-alert-content {
    text-align: center;
    padding: 40px 20px;
    max-width: 400px;
    width: 90%;
}

.proximity-alert-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

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

.proximity-alert-title {
    font-size: 32px;
    font-weight: bold;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.proximity-alert-distance {
    font-size: 48px;
    font-weight: bold;
    color: #4ade80;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.proximity-alert-contractor {
    font-size: 24px;
    color: white;
    margin-bottom: 30px;
    font-weight: 600;
}

.proximity-alert-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.proximity-alert-btn {
    padding: 20px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.proximity-alert-btn:active {
    transform: scale(0.95);
}

.proximity-alert-navigate {
    background: #28a745;
    color: white;
}

.proximity-alert-navigate:hover {
    background: #218838;
}

.proximity-alert-details {
    background: #2196f3;
    color: white;
}

.proximity-alert-details:hover {
    background: #1976d2;
}

.proximity-alert-dismiss {
    background: #dc3545;
    color: white;
}

.proximity-alert-dismiss:hover {
    background: #c82333;
}

.proximity-alert-info {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.proximity-alert-address {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    margin-bottom: 5px;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.terms-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px; /* Add padding for mobile */
}

.terms-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
}

.terms-content {
    position: relative;
    background: white;
    padding: 15px; /* Reduced padding */
    border-radius: 10px;
    width: 100%; /* Full width */
    max-width: 500px; /* Max width constraint */
    max-height: 85vh; /* Reduced height */
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    box-sizing: border-box; /* Include padding in width */
}

.terms-content h2 {
    margin-top: 0;
    font-size: 18px; /* Smaller heading */
    text-align: center;
}

.terms-text {
    margin: 15px 0;
    max-height: 350px; /* Reduced height */
    overflow-y: auto;
    padding: 10px; /* Reduced padding */
    background: #f9f9f9;
    border-left: 4px solid #dc3545;
    font-size: 14px; /* Smaller text */
    line-height: 1.4;
}

.terms-text ul {
    margin: 10px 0;
    padding-left: 20px; /* Fix bullet indentation */
}

.terms-text li {
    margin: 5px 0;
    word-wrap: break-word; /* Break long words */
}

.terms-text h3, .terms-text h4 {
    margin: 15px 0 8px 0;
    font-size: 16px; /* Smaller headings */
}

.terms-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-direction: column; /* Stack buttons on mobile */
}

.btn-decline, .btn-accept {
    padding: 12px;
    font-size: 14px; /* Smaller font */
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    width: 100%; /* Full width buttons */
}

.btn-decline {
    background: #6c757d;
    color: white;
}

.btn-accept {
    background: #dc3545;
    color: white;
}

/* Desktop improvements */
@media (min-width: 768px) {
    .terms-content {
        padding: 20px;
    }
    
    .terms-text {
        font-size: 15px;
    }
    
    .terms-buttons {
        flex-direction: row; /* Side by side on desktop */
    }
    
    .btn-decline, .btn-accept {
        font-size: 16px;
        padding: 15px;
    }
}

/* ========================================
   SETTINGS PANEL STYLES
   ======================================== */

/* Settings Panel - Slide-in from right */
.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: flex-end;
}

.settings-panel.active {
    display: flex;
}

.settings-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.settings-content {
    position: relative;
    background: white;
    width: 100%;
    max-width: 400px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0,0,0,0.3);
    animation: slideInRight 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.settings-panel.closing .settings-content {
    animation: slideOutRight 0.3s ease-out;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

/* Settings Header */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    color: white;
    border-bottom: 2px solid #f0f4f8;
}

.settings-header h2 {
    margin: 0;
    font-size: 24px;
    color: white;
}

.close-settings {
    font-size: 32px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.3s ease;
}

.close-settings:hover {
    transform: scale(1.2);
}

/* Settings Body */
.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    -webkit-overflow-scrolling: touch;
}

/* Setting Group */
.setting-group {
    margin-bottom: 0;
}

.settings-location-display {
    background: #f8f9fa;
    border: 2px solid #1a365d;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.location-coords {
    flex: 1;
    font-size: 14px;
    color: #1a365d;
    font-weight: 500;
    word-break: break-all;
}

.btn-share-location {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.btn-share-location:hover {
    background: #218838;
    transform: translateY(-1px);
}

.btn-share-location:active {
    transform: translateY(0);
}

.setting-label {
    display: block;
    color: #1a365d;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-description {
    color: #6c757d;
    font-size: 13px;
    margin-bottom: 15px;
    font-style: italic;
}

.setting-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #dee2e6, transparent);
    margin: 25px 0;
}

/* Alert Distance Display */
.alert-distance-display {
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(26, 54, 93, 0.3);
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-distance-display.active {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(26, 54, 93, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(26, 54, 93, 0.6);
    }
}

/* Base Distance Dropdown */
.base-distance-dropdown {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #1a365d;
    background: white;
    border: 2px solid #1a365d;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    min-height: 50px;
	-webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a365d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.base-distance-dropdown:hover {
    border-color: #2c5aa0;
    box-shadow: 0 2px 8px rgba(26, 54, 93, 0.2);
}

.base-distance-dropdown:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

/* Scale Tap Button */
.scale-tap-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.scale-tap-button {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    border: 2px solid #1a365d;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(26, 54, 93, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scale-tap-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.5);
}

.scale-tap-button:active {
    transform: scale(0.95);
}

.scale-value {
    display: block;
}

.scale-tap-label {
    color: #6c757d;
    font-size: 13px;
    text-align: center;
}

/* Radio Options */
.setting-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f0f4f8;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-option:hover {
    background: #e2e8f0;
    border-color: #1a365d;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #1a365d;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    background: #1a365d;
    border-color: #1a365d;
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radio-label {
    color: #1a365d;
    font-size: 15px;
    font-weight: 500;
}

.radio-option input[type="radio"]:checked ~ .radio-label {
    font-weight: 600;
}

/* Setting Toggle Row */
.setting-toggle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: #f0f4f8;
    border-radius: 8px;
}

.toggle-label-left,
.toggle-label-right {
    width: 60px;
    text-align: center;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.toggle-label-left {
    text-align: right;
}

.toggle-label-right {
    text-align: left;
}

/* Settings Footer */
.settings-footer {
    padding: 20px 25px;
    border-top: 2px solid #f0f4f8;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-footer .btn {
    width: 100%;
    padding: 15px;
    font-size: 16px;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .settings-content {
        max-width: 100%;
    }
    
    .settings-header {
        padding: 15px 20px;
    }
    
    .settings-header h2 {
        font-size: 20px;
    }
    
    .settings-body {
        padding: 20px;
    }
/*
    .scale-tap-button {
        width: 90px;
        height: 90px;
        font-size: 32px;
    }
    
    .alert-distance-display {
        font-size: 28px;
        padding: 18px;
    }
*/
.scale-tap-button {
    width: 70px;
    height: 70px;
    font-size: 24px;
}

.alert-distance-display {
    font-size: 16px;
    padding: 12px 20px;
    min-height: 50px;
}
.base-distance-dropdown {
    font-size: 16px;
    padding: 14px 16px;
    min-height: 50px;
}
}

/* Desktop - Settings panel doesn't fill entire screen */
@media (min-width: 769px) {
    .settings-panel {
        justify-content: center;
    }
    
    .settings-content {
        max-width: 450px;
        height: auto;
        max-height: 90vh;
        border-radius: 15px;
        margin-right: 50px;
    }
    
    .settings-header {
        border-radius: 15px 15px 0 0;
    }
}

/* Prevent body scroll when settings open */
body.settings-open {
    overflow: hidden;
}

/* Animation for settings button */
#settings-btn {
    transition: all 0.3s ease;
}

#settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(108, 117, 125, 0.4);
}

/* Next 5 Button */
.btn-next-5 {
    margin-bottom: 10px;
    padding: 12px 24px;
    background: #2196f3;
    color: #fff;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.btn-next-5:hover {
    background: #1976d2;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(33, 150, 243, 0.4);
}

.btn-next-5:active {
    transform: translateY(0);
}

.btn-next-5:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.location-action-buttons {
    margin-bottom: 15px;
}

/* ===================================
   AI Intel Modal Styles
   =================================== */

.ai-intel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-intel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
    pointer-events: auto;
}

.ai-intel-window {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: aiSlideIn 0.3s ease;
    z-index: 2;
    pointer-events: auto;
}

@keyframes aiSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* iOS Input Fix - Ensure inputs are interactive in modal */
.ai-intel-window input[type="text"],
.ai-intel-window #new-contractor-name {
    -webkit-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
    touch-action: auto !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
    cursor: text;
}

.ai-intel-window input[type="text"]:focus,
.ai-intel-window #new-contractor-name:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.ai-intel-header {
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-intel-title {
    font-size: 18px;
    font-weight: 700;
}

.ai-intel-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.ai-intel-close:hover {
    background: rgba(255,255,255,0.3);
}

.ai-intel-content {
    max-height: calc(90vh - 80px);
    overflow-y: auto;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.ai-intel-streaming {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1a365d;
    font-weight: 600;
    justify-content: center;
    padding: 40px 20px;
}

.ai-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e7ff;
    border-top-color: #1a365d;
    border-radius: 50%;
    animation: aiSpin 0.8s linear infinite;
}

@keyframes aiSpin {
    to { transform: rotate(360deg); }
}

.ai-contractor-name {
    font-size: 20px;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 8px;
}

.ai-contractor-address {
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
}

.ai-section {
    margin-bottom: 24px;
}

.ai-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-section-content {
    font-size: 14px;
    color: #333;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    background: #f0f4f8;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #2c5aa0;
}

.ai-findings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ai-findings-list li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.ai-findings-list li:before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #2c5aa0;
    font-weight: bold;
}

/* Confidence Badges */
.confidence-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
}

.confidence-badge.high {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.confidence-badge.medium {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.confidence-badge.low {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Source Quality Badges */
.source-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-badge.high {
    background: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

.source-badge.medium {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.source-badge.low {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

.ai-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 24px 0;
}

.ai-classification-section {
    background: #f0f4f8;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #1a365d;
}

.ai-classification-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 8px;
}

.ai-classification-hint {
    font-size: 13px;
    color: #1a365d;
    margin-bottom: 16px;
    opacity: 0.8;
}

.ai-classification-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.ai-btn-classify {
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    color: white;
}

.ai-btn-classify:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.ai-btn-ibew {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.ai-btn-ibew:hover {
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.4);
}

.ai-btn-ubcja {
    background: linear-gradient(135deg, #92400e 0%, #f59e0b 100%);
}

.ai-btn-ubcja:hover {
    box-shadow: 0 6px 20px rgba(146, 64, 14, 0.4);
}

.ai-btn-nonunion {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
}

.ai-btn-nonunion:hover {
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

.ai-success-msg {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    margin-top: 16px;
}

/* AI Intel Button on Location Cards */
.btn-ai-intel {
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-ai-intel:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.4);
}

/* Update Available Banner */
.update-banner {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 16px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.update-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 450px;
    margin: 0 auto;
}

.update-icon {
    font-size: 20px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.update-text {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
}

.update-btn {
    background: white;
    color: #28a745;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.update-btn:hover {
    background: #f8f9fa;
    transform: scale(1.05);
}

.update-dismiss {
    background: none;
    color: white;
    font-size: 24px;
    font-weight: 300;
    border: none;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.update-dismiss:hover {
    opacity: 1;
}

/* Mobile: Adjust update banner positioning for PWA */
@media (max-width: 768px) {
    .update-banner {
        top: 0;
        padding: 16px;
        z-index: 99999;
    }

    .update-content {
        gap: 8px;
    }

    .update-text {
        font-size: 13px;
    }

    .update-btn {
        padding: 10px 24px;
        font-size: 14px;
        font-weight: 700;
    }
}

/* AI Refresh Button inside Modal */
.ai-refresh-btn {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 16px auto;
    display: block;
    width: fit-content;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
    position: relative;
    overflow: hidden;
}

.ai-refresh-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.ai-refresh-btn:hover::before {
    left: 100%;
}

.ai-refresh-btn:hover {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.5);
}

.ai-refresh-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

/* Mobile: Make refresh button sticky at top */
@media (max-width: 768px) {
    .ai-refresh-btn {
        position: sticky;
        top: 0;
        z-index: 10;
        margin: 0 0 16px 0;
        width: 100%;
        border-radius: 0 0 10px 10px;
        box-shadow: 0 4px 15px rgba(23, 162, 184, 0.4);
        backdrop-filter: blur(10px);
    }
}


/* ===================================
   Market Intelligence Blue Space
   =================================== */

.market-intelligence {
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    color: white;
    padding: 24px 20px;
    margin: 20px auto;
    border-radius: 15px;
    max-width: 400px;
    width: 100%;
    min-width: 320px;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.market-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.market-subtitle {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 20px;
}

/* Segmented Control */
.segmented-control {
    display: flex;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 20px;
    position: relative;
}

.segment {
    flex: 1;
    padding: 10px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.segment.active {
    background: white;
    color: #1a365d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.segment:not(.active) {
    color: rgba(255, 255, 255, 0.7);
}

.segment:not(.active):active {
    color: rgba(255, 255, 255, 0.9);
    transform: scale(0.98);
}

/* Chart Containers */
.chart-container {
    display: none;
}

.chart-container.active {
    display: block;
}

.market-bars {
    margin-bottom: 16px;
}

.market-item {
    margin-bottom: 16px;
}

.market-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding: 0 4px;
}

.market-label-text {
    font-size: 14px;
    font-weight: 600;
}

.market-count {
    font-size: 12px;
    opacity: 0.9;
}

.market-bar {
    background: rgba(255,255,255,0.2);
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.market-fill {
    height: 100%;
    transition: width 1s ease;
    border-radius: 6px;
}

.market-fill-ibew {
    background: rgba(40, 167, 69, 0.9);
}

.market-fill-ubcja {
    background: rgba(255, 193, 7, 0.9);
}

.market-fill-nonunion {
    background: rgba(220, 53, 69, 0.9);
}

.market-classification-status {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.95;
}

.market-value-note {
    font-size: 11px;
    text-align: center;
    margin-top: 6px;
    opacity: 0.75;
    font-style: italic;
}

.market-footer {
    font-size: 11px;
    opacity: 0.8;
    text-align: center;
}

/* ===================== LOGIN SCREEN ===================== */

.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a365d 0%, #2c5aa0 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.login-container {
    max-width: 420px;
    width: 90%;
    margin: 20px;
    padding: 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .proximity-logo {
    margin-bottom: 15px;
}

.login-subtitle {
    color: #6c757d;
    font-size: 15px;
    margin: 10px 0 0 0;
}

.login-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #1a365d;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    border-color: #1a365d;
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.checkbox-group {
    margin-bottom: 25px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    user-select: none;
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
    position: relative;
}

.btn-login .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.login-error {
    margin-top: 15px;
    padding: 12px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    font-size: 14px;
    text-align: center;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .login-container {
        padding: 30px 20px;
    }

    .login-header .proximity-logo .logo-text {
        font-size: 28px;
    }
}

/* ===================== CHANGE PASSWORD ===================== */

.change-password-form {
    margin-top: 10px;
}

.change-password-form .form-group {
    margin-bottom: 12px;
}

.change-password-form input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.change-password-form input[type="password"]:focus {
    border-color: #1a365d;
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.btn-change-password {
    width: 100%;
    margin-top: 10px;
}

.change-password-message {
    margin-top: 12px;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.change-password-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.change-password-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.current-user-email {
    font-size: 14px;
    color: #6c757d;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #1a365d;
}

