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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 10px;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

header h1 {
    color: #2c3e50;
    font-size: 1.4rem;
    margin: 0;
    white-space: nowrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-email {
    font-size: 0.85rem;
    color: #555;
    background: #e8f4fd;
    padding: 4px 12px;
    border-radius: 12px;
}

.delivery-options {
    margin-bottom: 10px;
}

.delivery-options label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.delivery-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.delivery-btn {
    padding: 6px 12px;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
}

.delivery-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

.delivery-btn.active {
    border-color: #3498db;
    background: #e8f4fd;
    color: #2980b9;
    font-weight: 600;
}

.farm-mode-selector {
    max-width: 500px;
    margin: 0 auto 20px;
    text-align: center;
}

.farm-mode-selector label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.farm-mode-selector select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #3498db;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #2c3e50;
    background: white;
    cursor: pointer;
    appearance: auto;
}

.farm-mode-selector select:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.farm-mode-description {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #7f8c8d;
    font-style: italic;
}

.equity-mode-toggle {
    display: flex;
    gap: 0;
    margin-top: 5px;
}

.equity-mode-btn {
    flex: 1;
    padding: 8px 16px;
    border: 2px solid #8e44ad;
    background: white;
    color: #8e44ad;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.equity-mode-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.equity-mode-btn:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.equity-mode-btn.active {
    background: #8e44ad;
    color: white;
}

.equity-mode-btn:hover:not(.active) {
    background: #f4ecf7;
}

.business-area-tabs {
    display: flex;
    gap: 0;
    margin-top: 5px;
}

.biz-area-btn {
    flex: 1;
    padding: 8px 16px;
    border: 2px solid #27ae60;
    background: white;
    color: #27ae60;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.biz-area-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.biz-area-btn:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.biz-area-btn:not(:first-child):not(:last-child) {
    border-left: none;
}

.biz-area-btn.active {
    background: #27ae60;
    color: white;
}

.biz-area-btn:hover:not(.active) {
    background: #eafaf1;
}

.absentee-mode-toggle {
    display: flex;
    gap: 0;
    margin-top: 5px;
}

.absentee-mode-btn {
    flex: 1;
    padding: 8px 16px;
    border: 2px solid #e67e22;
    background: white;
    color: #e67e22;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.absentee-mode-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.absentee-mode-btn:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.absentee-mode-btn.active {
    background: #e67e22;
    color: white;
}

.absentee-mode-btn:hover:not(.active) {
    background: #fef5e7;
}

.filter-hint {
    display: block;
    margin-top: 4px;
    color: #95a5a6;
    font-size: 0.78rem;
}

.ltv-badge, .equity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.ltv-low {
    background: #d5f5e3;
    color: #1e8449;
}

.ltv-mid {
    background: #fef9e7;
    color: #b7950b;
}

.ltv-high {
    background: #fadbd8;
    color: #c0392b;
}

.mover-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.mover-hot {
    background: #e74c3c;
    color: #fff;
}

.mover-warm {
    background: #f39c12;
    color: #fff;
}

.mover-mild {
    background: #3498db;
    color: #fff;
}

.equity-high {
    background: #d5f5e3;
    color: #1e8449;
}

.equity-mid {
    background: #fef9e7;
    color: #b7950b;
}

.equity-low {
    background: #fadbd8;
    color: #c0392b;
}

.equity-results-scroll {
    overflow-x: auto;
}

.equity-results-scroll table {
    min-width: 1200px;
}

.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.search-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.search-type-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: #ecf0f1;
    color: #7f8c8d;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #dfe6e9;
}

.tab-btn.active {
    background: #3498db;
    color: white;
}

.search-section {
    display: none;
}

.search-section.active {
    display: block;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

hr {
    border: none;
    border-top: 1px solid #ecf0f1;
    margin: 20px 0;
}

h3 {
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 15px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.btn-success {
    padding: 12px 24px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-success:hover {
    background: #219a52;
}

.btn-success:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.count-confirmation {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px;
    background: #eaf7ee;
    border: 1px solid #27ae60;
    border-radius: 8px;
}

.count-result {
    flex: 1;
    font-weight: 600;
    color: #1e8449;
    font-size: 0.9rem;
}

.btn-pull-data {
    white-space: nowrap;
    padding: 10px 20px;
    font-size: 0.9rem;
}

.map-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#map {
    height: 500px;
    width: 100%;
}

.info-text {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.polygon-status {
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.polygon-status.success {
    background: #d5f5e3;
    color: #27ae60;
}

.polygon-status.warning {
    background: #fdebd0;
    color: #e67e22;
}

.results-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-header h2 {
    color: #2c3e50;
    font-size: 1.3rem;
}

.results-info {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.save-farm-section {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.save-farm-section .form-group {
    flex: 1;
    margin-bottom: 0;
}

.save-status {
    font-size: 0.9rem;
    padding: 8px 0;
}

.save-status.success {
    color: #27ae60;
}

.save-status.error {
    color: #e74c3c;
}

.results-table-container {
    overflow-x: auto;
}

.placeholder-text {
    text-align: center;
    color: #bdc3c7;
    padding: 40px;
}

.sample-note {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 15px;
    margin-top: 10px;
    border-top: 1px solid #ecf0f1;
    font-size: 0.9em;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
    text-transform: uppercase;
}

tr:hover {
    background: #f8f9fa;
}

.property-count {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.view-btn {
    padding: 6px 12px;
    background: #ecf0f1;
    border: none;
    border-radius: 6px;
    color: #2c3e50;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.view-btn:hover {
    background: #dfe6e9;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    color: #7f8c8d;
    cursor: pointer;
}

.close-btn:hover {
    color: #2c3e50;
}

#modalTitle {
    margin-bottom: 20px;
    color: #2c3e50;
}

.property-list {
    display: grid;
    gap: 15px;
}

.property-card {
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    padding: 15px;
}

.property-card h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.property-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    font-size: 0.9rem;
}

.property-details span {
    color: #7f8c8d;
}

.property-details strong {
    color: #2c3e50;
}

.error-message {
    background: #fdeaea;
    color: #e74c3c;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    #map {
        height: 350px;
    }
    
    .save-farm-section {
        flex-direction: column;
        align-items: stretch;
    }

    .count-confirmation {
        flex-direction: column;
    }
}

.pac-container {
    z-index: 10000 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.tier-selection {
    margin-top: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fb 0%, #eef1f5 100%);
    border-radius: 12px;
    border: 1px solid #d0d7de;
}

.tier-selection-header {
    margin-bottom: 14px;
}

.tier-selection h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.01em;
}

.tier-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.tier-card {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid #d0d7de;
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.tier-card:hover {
    border-color: #7baaf7;
    background: #f6f9ff;
}

.tier-card.selected {
    border-color: #3b7ddd;
    background: #edf3ff;
    box-shadow: 0 0 0 3px rgba(59, 125, 221, 0.12);
}

.tier-radio {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #c0c8d0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tier-card.selected .tier-radio {
    border-color: #3b7ddd;
}

.tier-radio-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.2s;
}

.tier-card.selected .tier-radio-dot {
    background: #3b7ddd;
}

.tier-info {
    flex: 1;
    min-width: 0;
}

.tier-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
}

.tier-desc {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.3;
    margin-top: 1px;
}

.tier-price-tag {
    flex-shrink: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #16643a;
    white-space: nowrap;
}

.tier-price-tag span {
    font-size: 0.7rem;
    font-weight: 500;
    color: #6b7280;
}

.tier-cost-summary {
    text-align: center;
    margin: 0 0 16px 0;
    padding: 10px 14px;
    background: white;
    border-radius: 8px;
    border: 1px solid #d0d7de;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a2e;
}

.tier-payment-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}

.stripe-payment-section {
    margin: 0 0 14px 0;
}

.stripe-card-element {
    padding: 14px;
    border: 2px solid #d0d7de;
    border-radius: 10px;
    background: white;
    transition: border-color 0.2s;
}

.stripe-card-element:focus-within {
    border-color: #3b7ddd;
    box-shadow: 0 0 0 3px rgba(59, 125, 221, 0.12);
}

.stripe-card-errors {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 6px;
    min-height: 18px;
}

.btn-pay-pull {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    letter-spacing: 0.01em;
}

.charge-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #d4edda;
    color: #155724;
    margin-left: 8px;
}
