:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #60a5fa;
    --success: #10b981;
    --danger: #ef4444;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

body {
    padding-bottom: 60px;
}

/* Utilities */
.pad10px {
    padding: 10px;
}

/* Footer */
.footerContainer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Contact Cards */
.contact-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    width: clamp(280px, 22vw, 380px);
    margin: 12px;
    box-shadow: var(--shadow-lg);
    display: inline-block;
    vertical-align: top;
    transition: transform 0.2s, box-shadow 0.2s;
}

.contact-card.good-contact {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-secondary) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.contact-card.bad-contact {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, var(--bg-secondary) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.contact-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.card-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.contact-info-header {
    display: flex;
    flex-direction: column;
}

.contact-name {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.contact-location {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
    word-break: break-word;
    white-space: normal;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.card-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

.badge.inactive {
    opacity: 0.4;
    filter: grayscale(80%);
}

.badge:hover:not(.inactive) {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item-row {
    display: flex;
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-item .label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item .value {
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.info-item a.value {
    color: var(--accent-light);
    text-decoration: none;
    transition: color 0.2s;
}

.info-item a.value:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

.equipment-summary {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.8125rem;
    font-weight: 600;
}

.equipment-for {
    color: var(--success);
}

.equipment-not-for {
    color: #6b7280;
}

.carrier-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.carrier-type-toggle {
    display: flex;
    gap: 6px;
}

.carrier-type-btn {
    flex: 1;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.carrier-type-btn:hover {
    background: var(--bg-primary);
    border-color: var(--accent-primary);
}

.carrier-type-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    font-weight: 600;
}

.truck-count-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.truck-count-input label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.truck-count {
    flex: 1;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s;
}

.truck-count:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.equipment-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.equipment-tag {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: #6b7280;
    color: white;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.equipment-tag:hover {
    background: #9ca3af;
    border-color: #9ca3af;
}

.equipment-tag.active {
    background: #86efac;
    border-color: #86efac;
    color: #166534;
    font-weight: 600;
}

.notes-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    transition: all 0.2s;
}

.notes-textarea::placeholder {
    color: var(--text-muted);
}

.notes-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mark-contacted-btn {
    width: 100%;
    padding: 14px 16px;
    min-height: 52px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--accent-primary);
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mark-contacted-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.mark-contacted-btn.contacted-recent {
    background: var(--success);
    border-color: var(--success);
}

.mark-contacted-btn.contacted-recent:hover {
    background: #059669;
}

.mark-contacted-btn.contacted-old {
    background: #6b7280;
    border-color: #6b7280;
    opacity: 0.7;
}

.mark-contacted-btn.contacted-old:hover {
    background: #4b5563;
    opacity: 1;
}

/* Dashboard Styles */
.dashboard-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 24px;
}

.search-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.search-section svg {
    color: var(--accent-primary);
}

.refresh-btn {
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 40px;
    min-height: 40px;
}

.refresh-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-light);
    transform: scale(1.05);
}

.refresh-btn.spinning svg {
    animation: spin 0.5s ease-in-out;
}

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

#location-search {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    min-width: 250px;
}

#location-search:focus {
    color: var(--accent-light);
}

fieldset {
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    background: var(--bg-primary);
}

legend {
    padding: 0 12px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

fieldset label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

fieldset label:hover {
    color: var(--text-primary);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

input[type="number"],
input[type="text"] {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.2s;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.distance-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 24px;
}

.distance-control label {
    font-weight: 600;
    color: var(--text-primary);
}

#carrier-cards-container {
    padding: 20px;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar form {
    display: inline-block;
    margin: 0;
}

.btn {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.25s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

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

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

/* Page Container */
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Add Carrier Page */
.add-carrier-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    min-height: calc(100vh - 200px);
}

@media (max-width: 900px) {
    .add-carrier-wrapper {
        grid-template-columns: 1fr;
    }
}

.add-carrier-form-section,
.preview-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 24px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.form-textarea {
    width: 100%;
    min-height: 180px;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    resize: vertical;
    transition: all 0.2s;
}

.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.equipment-fieldset {
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    background: var(--bg-primary);
}

.equipment-fieldset legend {
    padding: 0 12px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--bg-tertiary);
}

.checkbox-label:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.checkbox-label:has(input:checked) {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-light);
}

.preview-section {
    display: flex;
    flex-direction: column;
}

.preview-container {
    flex: 1;
    min-height: 200px;
    border-radius: 8px;
    background: var(--bg-primary);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 12px;
}

.preview-placeholder {
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}