/* ─── Phone Directory Page ─────────────────────────────────── */
.phone-dir {
    padding: 0 0 60px;
}

.phone-dir__hero {
    background: linear-gradient(to right, #0f766e 0%, #0d9488 60%, #14b8a6 100%);
    color: #fff;
    padding: 48px 24px;
    border-radius: 16px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 148px;
    animation: fadeSlideDown 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.phone-dir__hero-inner {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    text-align: center;
}

.phone-dir__inner {
    width: 100%;
    margin: 0;
    padding: 0 0 12px;
}

/* ─── Building Grid — 2 independent columns ─────────────── */
.phone-building-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.phone-building-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.phone-dir__hero-icon {
    font-size: 3rem;
    color: #ccfbf1;
    flex-shrink: 0;
}

.phone-dir__hero-text h1 {
    font-size: 1.55rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
    text-align: center;
}

.phone-dir__hero-text h1 i {
    margin-right: 8px;
    font-size: 1.2rem;
    opacity: 0.85;
}

.phone-dir__hero-text p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    text-align: center;
}

/* ─── Search Box ──────────────────────────────────────────── */
.phone-dir__search-wrap {
    position: relative;
    margin-bottom: 28px;
    animation: fadeSlideUp 0.5s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.phone-dir__search-wrap i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #0f766e;
    font-size: 1.1rem;
    pointer-events: none;
}

#phoneSearch {
    width: 100%;
    padding: 13px 16px 13px 44px;
    border: 2px solid #d1fae5;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 180ms, box-shadow 180ms;
    background: #fff;
    box-sizing: border-box;
}

#phoneSearch:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

#searchCount {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 6px;
    padding-left: 4px;
}

/* ─── Building Section ────────────────────────────────────── */
.phone-building {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    animation: fadeSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-play-state: paused;
}

.phone-building.is-visible {
    animation-play-state: running;
}

.phone-building__header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #134e4a;
    color: #fff;
    padding: 22px 24px;
    cursor: pointer;
    user-select: none;
    transition: filter 180ms, transform 180ms;
}

.phone-building__header:hover {
    filter: brightness(1.12);
    transform: translateX(3px);
}

/* ── Per-building header colors — gradient dark→light ── */
.phone-building--red    .phone-building__header { background: linear-gradient(to right, #7f1d1d, #dc2626); }
.phone-building--blue   .phone-building__header { background: linear-gradient(to right, #1e3a8a, #3b82f6); }
.phone-building--orange .phone-building__header { background: linear-gradient(to right, #9a3412, #f97316); }
.phone-building--teal   .phone-building__header { background: linear-gradient(to right, #134e4a, #0d9488); }
.phone-building--purple .phone-building__header { background: linear-gradient(to right, #4c1d95, #8b5cf6); }
.phone-building--green  .phone-building__header { background: linear-gradient(to right, #14532d, #16a34a); }
.phone-building--amber  .phone-building__header { background: linear-gradient(to right, #92400e, #f59e0b); }

/* ── Phone extension badge — match panel color ── */
.phone-building--red    .phone-ext { background: #dc2626; }
.phone-building--blue   .phone-ext { background: #2563eb; }
.phone-building--orange .phone-ext { background: #ea580c; }
.phone-building--teal   .phone-ext { background: #0f766e; }
.phone-building--purple .phone-ext { background: #7c3aed; }
.phone-building--green  .phone-ext { background: #15803d; }
.phone-building--amber  .phone-ext { background: #d97706; }

.phone-building__header i {
    font-size: 1.3rem;
    color: #ffffff;
    flex-shrink: 0;
}

.phone-building__title {
    font-size: 1rem;
    font-weight: 500;
    flex: 1;
}

.phone-building__count {
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
}

.phone-building__chevron {
    font-size: 1.1rem;
    transition: transform 250ms;
    color: rgba(255, 255, 255, 0.7);
}

.phone-building.is-collapsed .phone-building__chevron {
    transform: rotate(-90deg);
}

.phone-building.is-collapsed .phone-building__body {
    grid-template-rows: 0fr;
    opacity: 0;
    margin: 0;
    padding: 0;
}

/* ─── Table ───────────────────────────────────────────────── */
.phone-building__body {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows 400ms cubic-bezier(0.4, 0, 0.2, 1), opacity 400ms ease;
}

.phone-building__body > .phone-table {
    min-height: 0;
    overflow: hidden;
}

.phone-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}

.phone-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.phone-table thead th {
    background: #1f2937;
    color: #fff;
    padding: 10px 14px;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

.phone-table thead th:last-child {
    text-align: center;
}

.phone-table tbody tr {
    transition: background 150ms;
}

.phone-table tbody tr:nth-child(odd)  { background: #f9fafb; }
.phone-table tbody tr:nth-child(even) { background: #fff; }
.phone-table tbody tr:hover           { background: #f0fdf4; }

.phone-table tbody tr.is-hidden {
    display: none;
}

.phone-table tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    color: #374151;
}

.phone-table tbody td:last-child {
    text-align: center;
}

.phone-ext {
    display: inline-block;
    background: #0f766e;
    color: #fff;
    font-weight: 700;
    font-size: 0.92rem;
    padding: 3px 12px;
    border-radius: 8px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    transition: transform 150ms, box-shadow 150ms;
}

.phone-ext:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.phone-floor {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.phone-sub {
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 2px;
}

/* ─── No results ──────────────────────────────────────────── */
#noResults {
    display: none;
    text-align: center;
    padding: 48px 20px;
    color: #9ca3af;
}

#noResults i {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
    color: #d1d5db;
}

@media (max-width: 1080px) {
    .phone-dir__hero {
        padding: 40px 24px;
        min-height: 132px;
    }
}

@media (max-width: 900px) {
    .phone-building-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        width: 100%;
    }

    .phone-building-col {
        display: contents;
    }

    .phone-building {
        width: 100%;
        justify-self: stretch;
    }

    .phone-building[data-order="1"] { order: 1; }
    .phone-building[data-order="2"] { order: 2; }
    .phone-building[data-order="3"] { order: 3; }
    .phone-building[data-order="4"] { order: 4; }
    .phone-building[data-order="5"] { order: 5; }
    .phone-building[data-order="6"] { order: 6; }
    .phone-building[data-order="7"] { order: 7; }
}

@media (max-width: 640px) {
    .phone-table thead th:nth-child(2),
    .phone-table tbody td:nth-child(2) { display: none; }
}

/* ─── Animations ──────────────────────────────────────────── */
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-18px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

/* Table rows — subtle slide-in when panel opens */
.phone-building__body .phone-table tbody tr {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 220ms, transform 220ms;
}

.phone-building:not(.is-collapsed) .phone-table tbody tr {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger rows */
.phone-table tbody tr:nth-child(1)  { transition-delay: 30ms; }
.phone-table tbody tr:nth-child(2)  { transition-delay: 55ms; }
.phone-table tbody tr:nth-child(3)  { transition-delay: 80ms; }
.phone-table tbody tr:nth-child(4)  { transition-delay: 105ms; }
.phone-table tbody tr:nth-child(5)  { transition-delay: 130ms; }
.phone-table tbody tr:nth-child(6)  { transition-delay: 155ms; }
.phone-table tbody tr:nth-child(7)  { transition-delay: 180ms; }
.phone-table tbody tr:nth-child(8)  { transition-delay: 205ms; }
.phone-table tbody tr:nth-child(n+9){ transition-delay: 230ms; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .phone-dir__hero,
    .phone-dir__search-wrap,
    .phone-building { animation: none; }

    .phone-building__body .phone-table tbody tr {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
