/* Make the contact modal wider */
#contact-modal .modal-container {
    max-width: 700px;
    width: 100%;
}

/* Add Contact split-button dropdown */
.add-contact-dropdown {
    position: relative;
    display: inline-block;
}

.add-contact-caret {
    font-size: 11px;
    margin-left: 6px;
    transition: transform 0.2s;
}

.add-contact-dropdown.open .add-contact-caret {
    transform: rotate(180deg);
}

.add-contact-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 260px;
    background: #ffffff;
    border: 1px solid #e1e8ef;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 4px 10px -4px rgba(0, 0, 0, 0.1);
    padding: 8px;
    z-index: 1000;
    display: none;
}

.add-contact-dropdown.open .add-contact-menu {
    display: block;
}

.add-contact-menu-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    padding: 6px 10px 4px;
}

.add-contact-menu-divider {
    height: 1px;
    background: #eef2f7;
    margin: 6px 4px;
}

.add-contact-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s;
}

.add-contact-menu-item:hover {
    background: #f1f5f9;
}

.add-contact-menu-item > i {
    width: 18px;
    text-align: center;
    color: #3b82f6;
    font-size: 14px;
}

.add-contact-menu-item span {
    display: flex;
    flex-direction: column;
}

.add-contact-menu-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.add-contact-menu-item-sub {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.3;
}

.tab-navigation {
    display: flex;
    /* Seven tabs overflow narrower content areas and the last one ("Groups") gets
       clipped by the overflow:hidden shell - wrap instead. */
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e1e8ef;
    padding-bottom: 0;
}

.tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #64748b;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #3b82f6;
    background: #f8fafc;
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.tab-count {
    background: #e1e8ef;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.tab-btn.active .tab-count {
    background: #dbeafe;
    color: #3b82f6;
}

.form-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 24px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e1e8ef;
}

.form-section-title:first-child {
    margin-top: 0;
}

.state-badge,
.type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.state-lead,
.type-lead {
    background: #e0e7ff;
    color: #4338ca;
}

.state-prospect,
.type-prospect {
    background: #fef3c7;
    color: #92400e;
}

.state-customer,
.type-customer {
    background: #dcfce7;
    color: #166534;
}

/* Customer-side sub-types (inferred from where the contact lives) */
.type-building {
    background: #cffafe;
    color: #155e75;
}

.type-location {
    background: #fae8ff;
    color: #86198f;
}

.type-group {
    background: #ffedd5;
    color: #9a3412;
}

/* Autocomplete Styles */
.autocomplete-input {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: none;
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f8fafc;
}

.autocomplete-item.create-new {
    background: #f0f9ff;
    color: #0369a1;
    font-weight: 500;
    border-top: 2px solid #e0f2fe;
}

.autocomplete-item.create-new:hover {
    background: #e0f2fe;
}

.autocomplete-item.create-new i {
    margin-right: 6px;
    color: #0ea5e9;
}

.autocomplete-no-results {
    padding: 12px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.autocomplete-item-name {
    font-weight: 500;
    color: #0f172a;
}

.autocomplete-item-meta {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.attachments-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.attachments-link:hover {
    color: #2563eb;
}

.attachments-count {
    font-size: 13px;
}

/* Google Places address autocomplete suggestions must sit ABOVE the modal
   overlay (z-index 9999); the Places dropdown defaults to 1000 and would
   otherwise render hidden behind the Add/Edit Contact modals. */
.pac-container {
    z-index: 10000 !important;
}
