/* addresses.css — DeliveryHub address book page styles */

/* Toolbar (search + buttons row) */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

/* Search wrapper */
.search-wrap { position: relative; width: 240px; }
.search-input {
    padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    outline: none; width: 100%; transition: border-color 0.2s; box-sizing: border-box; color: #6b7280;
}
.search-input:focus { border-color: #FF8C00; box-shadow: 0 0 0 3px rgba(255,140,0,0.15); }

/* Add button */
.tab-add-btn {
    margin-left: auto; white-space: nowrap; padding: 10px 18px;
    background: #FF8C00; color: #fff; border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; transition: background 0.2s;
}
.tab-add-btn:hover { background: #e07b00; }

/* Export button */
.btn-export {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px;
    border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
    font-size: 13px; font-weight: 500; color: #374151; cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.btn-export svg { width: 16px; height: 16px; }
.btn-export:hover { background: #f9fafb; border-color: #FF8C00; color: #FF8C00; }
.btn-export:hover svg { stroke: #FF8C00; }

/* ===== Column header row ===== */
.address-list-header {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    gap: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.alh-icon { width: 36px; flex-shrink: 0; }
.alh-name { width: 180px; flex-shrink: 0; }
.alh-contact { width: 140px; flex-shrink: 0; }
.alh-phone { width: 130px; flex-shrink: 0; }
.alh-dept { width: 120px; flex-shrink: 0; }
.alh-addr { flex: 1; min-width: 0; }
.alh-actions { width: 72px; flex-shrink: 0; }

/* ===== Address List (row-based) ===== */
.address-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.address-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 20px;
    transition: box-shadow 0.2s, background 0.15s;
    cursor: pointer;
}
.address-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: #fafbfc;
}

/* Icon */
.address-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.address-card-icon svg {
    width: 18px;
    height: 18px;
    stroke: #3b82f6;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Company name column */
.address-card-name {
    width: 180px;
    flex-shrink: 0;
    min-width: 0;
}
.address-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Subtitle (contact · phone) — hidden on desktop */
.address-card-subtitle { display: none; }
/* Mobile detail rows — hidden on desktop */
.address-card-mobile-details { display: none; }

/* Contact column */
.address-card-contact {
    width: 140px;
    flex-shrink: 0;
    min-width: 0;
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Phone column */
.address-card-phone {
    width: 130px;
    flex-shrink: 0;
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
}

/* Department column */
.address-card-dept {
    width: 120px;
    flex-shrink: 0;
    min-width: 0;
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Address column — takes remaining space */
.address-card-addr {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
}
.address-card-addr-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* GPS badge */
.address-map-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: #3b82f6;
    font-weight: 600;
    flex-shrink: 0;
    padding: 2px 6px;
    background: #eff6ff;
    border-radius: 4px;
}

/* Actions */
.address-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.address-card-actions .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}
.address-card-actions .btn-icon svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.address-card-actions .btn-icon:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}
.address-card-actions .btn-icon.edit-btn svg { stroke: #6b7280; fill: none; }
.address-card-actions .btn-icon.edit-btn:hover { border-color: #3b82f6; background: #eff6ff; }
.address-card-actions .btn-icon.edit-btn:hover svg { stroke: #3b82f6; }
.address-card-actions .btn-icon.delete-btn svg { stroke: #9ca3af; fill: none; }
.address-card-actions .btn-icon.delete-btn:hover { border-color: #fecaca; background: #fef2f2; }
.address-card-actions .btn-icon.delete-btn:hover svg { stroke: #ef4444; }

/* Department tag */
.address-dept-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #F3F4F6;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
}

/* Favorite button */
.fav-btn {
    background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px 6px; transition: transform 0.2s;
    color: #d1d5db;
}
.fav-btn:hover { transform: scale(1.2); }
.fav-btn.active { color: #3b82f6; }

/* Default sender tag */
.default-sender-tag { color: #3b82f6; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}
.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* Form section (hidden by default, shown when editing/adding) */
.form-section { display: none; }
.form-section.active { display: block; }

/* Form card */
.form-card {
    background: #fff; border-radius: 12px; padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.form-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.form-card .form-group { margin-bottom: 14px; }
.form-card .form-group label { font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 5px; display: block; }
.form-card .form-group label .req { color: #ef4444; font-weight: 600; }
.form-card .form-group input, .form-card .form-group select, .form-card .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 13px; color: #6b7280; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    outline: none; transition: border-color 0.2s; background: #fff; box-sizing: border-box;
}
.form-card .form-group input:focus, .form-card .form-group select:focus, .form-card .form-group textarea:focus {
    border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-card .form-group textarea { resize: vertical; min-height: 60px; }

/* Form row grid */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Form section headers */
.form-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.form-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.form-section-icon svg {
    width: 18px;
    height: 18px;
    stroke: #3b82f6;
}
.form-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}
.form-section-desc {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}
.form-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 24px 0;
}

/* Form actions (save/cancel buttons) */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

/* Cancel button */
.btn-cancel { padding: 10px 18px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; color: #374151; transition: all 0.15s; }
.btn-cancel:hover { background: #f9fafb; }

/* Back button */
.header-back-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
    border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
    font-size: 13px; font-weight: 500; color: #374151; cursor: pointer;
    font-family: inherit; transition: all 0.15s; margin-bottom: 12px;
}
.header-back-btn:hover { background: #f9fafb; border-color: #3b82f6; color: #3b82f6; }

/* Phone input wrap */
.phone-input-wrap { display: flex; align-items: center; border: 1px solid #d1d5db; border-radius: 8px; background: white; overflow: hidden; transition: border-color 0.2s; }
.phone-input-wrap:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.phone-prefix { padding: 10px 10px 10px 12px; font-size: 13px; color: #6b7280; background: #f9fafb; border-right: 1px solid #e5e7eb; white-space: nowrap; font-weight: 500; }
.phone-input-wrap input { border: none !important; padding: 10px 12px !important; font-size: 13px; flex: 1; background: transparent; outline: none; box-shadow: none !important; }

/* Section title (within form) */
.section-title { font-size: 14px; font-weight: 600; color: #6b7280; margin-bottom: 12px; margin-top: 20px; padding-bottom: 8px; border-bottom: 1px solid #e5e7eb; }

/* Export button */
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.btn-export svg { width: 16px; height: 16px; }
.btn-export:hover { background: #f9fafb; border-color: #3b82f6; color: #3b82f6; }
.btn-export:hover svg { stroke: #3b82f6; }

/* ===== Mobile: card layout ===== */
@media (max-width: 768px) {
    .address-list-header { display: none; }

    .address-cards-grid { gap: 10px; }

    .address-card {
        flex-wrap: wrap;
        padding: 0;
        gap: 0;
        border-radius: 12px;
        overflow: hidden;
    }

    /* -- Header row: icon + name/subtitle + actions -- */
    .address-card-icon {
        margin: 16px 0 16px 16px;
    }
    .address-card-name {
        width: auto;
        flex: 1;
        min-width: 0;
        padding: 14px 0 14px 14px;
    }
    .address-card-subtitle {
        display: block;
        font-size: 12px;
        color: #6b7280;
        margin-top: 2px;
    }
    .address-card-actions {
        padding: 14px 16px 14px 0;
        align-self: flex-start;
    }

    /* -- Hide desktop-only columns -- */
    .address-card-contact,
    .address-card-phone,
    .address-card-dept,
    .address-card-addr { display: none; }

    /* -- Mobile detail rows -- */
    .address-card-mobile-details {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding: 0 20px 16px;
        gap: 12px;
        border-top: 1px solid #f3f4f6;
        padding-top: 14px;
    }
    .mobile-detail-row {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 14px;
        color: #374151;
    }
    .mobile-detail-row svg {
        width: 20px;
        height: 20px;
        stroke: #9ca3af;
        flex-shrink: 0;
    }
    .mobile-detail-row span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-detail-row .address-dept-tag {
        white-space: nowrap;
    }

    .form-row { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-wrap { width: 100%; }
    .tab-add-btn { margin-left: 0; }
}
