/* =============================================
   Employee Directory v2.1.0
   Fixed: Square photos (border-radius: 12px),
          Responsive grid, Single profile template,
          QR token-only access
   ============================================= */

/* ── Shared ─────────────────────────────────── */
.ed-directory,
.ed-profile-page {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Filter Bar ─────────────────────────────── */
.ed-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 36px;
}
.ed-filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    margin-right: 4px;
    white-space: nowrap;
}
.ed-filter-btn {
    padding: 6px 18px;
    border: 1.5px solid #d1d5db;
    border-radius: 20px;
    background: #fff;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s ease;
}
.ed-filter-btn:hover {
    border-color: #4f46e5;
    color: #4338ca;
}
.ed-filter-btn.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
    font-weight: 600;
}

/* ── Employee Grid ──────────────────────────── */
.ed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

@keyframes ed-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Employee Card ──────────────────────────── */
.ed-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow .22s ease, transform .22s ease;
    display: flex;
    flex-direction: column;
}
.ed-card:hover {
    box-shadow: 0 10px 32px rgba(79, 70, 229, .12);
    transform: translateY(-4px);
}

/* ── Card Photo — SQUARE with border-radius 12 ── */
.ed-card-photo {
    width: 100%;
    aspect-ratio: 1 / 1;     /* Forces square shape */
    overflow: hidden;
    background: #eef0f7;
    border-radius: 12px 12px 0 0; /* Top corners only — card bottom has separate radius */
    line-height: 0;
}
.ed-card-photo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;        /* Fills the square, crops smartly */
    object-position: center top; /* Favors face/head area */
    transition: transform .3s ease;
}
.ed-card:hover .ed-card-photo img {
    transform: scale(1.04);
}

/* ── Card Body ──────────────────────────────── */
.ed-card-body {
    padding: 16px 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 3px;
    flex: 1;
}

.ed-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.3;
    width: 100%;
    text-align: center;
}

.ed-card-role {
    font-size: 0.82rem;
    color: #4f46e5;
    font-weight: 600;
    margin: 0;
    text-align: center;
    width: 100%;
}

.ed-card-dept {
    font-size: 0.75rem;
    color: #9ca3af;
    margin: 0;
    text-align: center;
    width: 100%;
}

/* ── QR Code on Card ────────────────────────── */
.ed-card-qr {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
}
.ed-card-qr img {
    display: block;
    width: 88px;
    height: 88px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 4px;
    background: #fff;
    margin: 0 auto;
    object-fit: contain;
}
.ed-card-qr svg {
    display: block;
    width: 88px;
    height: 88px;
    margin: 0 auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 4px;
    background: #fff;
    box-sizing: border-box;
}
.ed-card-qr-label {
    font-size: 0.68rem;
    color: #9ca3af;
    margin: 0;
    text-align: center;
}

.ed-no-results {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 48px 0;
}

/* ═══════════════════════════════════════════════
   SINGLE EMPLOYEE PROFILE PAGE
   ═══════════════════════════════════════════════ */

.ed-profile-page {
    max-width: 900px;
}

.ed-profile-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ed-profile-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
    align-items: start;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .07);
}

/* ── Profile Photo — SQUARE with border-radius 12 ── */
.ed-profile-photo-wrap {
    display: flex;
    justify-content: center;
}
.ed-profile-photo {
    width: 180px;
    height: 180px;
    border-radius: 12px;          /* Square with rounded corners, radius 12 */
    overflow: hidden;
    border: 2px solid #e5e7eb;
    background: #f3f4f6;
    flex-shrink: 0;
}
.ed-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

/* ── Profile Info ── */
.ed-profile-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.ed-profile-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.2;
}

.ed-profile-designation {
    font-size: 1rem;
    font-weight: 600;
    color: #4f46e5;
    margin: 0;
}

.ed-profile-dept-badge {
    display: inline-block;
    background: #ede9fe;
    color: #5b21b6;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    width: fit-content;
}

.ed-profile-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ed-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #9ca3af;
}

.ed-bio-text {
    font-size: 0.93rem;
    color: #4b5563;
    line-height: 1.7;
    margin: 0;
}

.ed-contact-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ed-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2563eb;
    text-decoration: none;
    font-size: 0.92rem;
    transition: color .15s;
}
.ed-contact-item:hover {
    color: #1d4ed8;
    text-decoration: underline;
}
.ed-contact-item svg {
    color: #6b7280;
    flex-shrink: 0;
}

/* ── Profile QR ── */
.ed-profile-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.ed-profile-qr {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 6px;
    background: #fff;
}
.ed-profile-qr img,
.ed-profile-qr svg {
    display: block;
    width: 130px;
    height: 130px;
    object-fit: contain;
}
.ed-qr-caption {
    font-size: 0.68rem;
    color: #9ca3af;
    text-align: center;
    margin: 0;
    max-width: 130px;
}

/* Back link */
.ed-back-wrap {
    padding-left: 4px;
}
.ed-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #6b7280;
    text-decoration: none;
    transition: color .15s;
}
.ed-back-link:hover {
    color: #4f46e5;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */

/* Tablet: 2 column grid */
@media (max-width: 900px) {
    .ed-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ed-profile-card {
        grid-template-columns: 160px 1fr;
        gap: 28px;
        padding: 28px;
    }
}

/* Mobile: single column */
@media (max-width: 600px) {
    .ed-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .ed-profile-card {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 24px 20px;
    }
    .ed-profile-photo-wrap {
        justify-content: center;
    }
    .ed-profile-photo {
        width: 140px;
        height: 140px;
        margin: 0 auto;
    }
    .ed-profile-info {
        align-items: center;
    }
    .ed-profile-name {
        font-size: 1.4rem;
    }
    .ed-contact-list {
        align-items: center;
    }
    .ed-profile-qr-wrap {
        grid-column: 1;
        flex-direction: column;
    }
    .ed-qr-caption {
        text-align: center;
    }
}

@media (max-width: 400px) {
    .ed-grid {
        grid-template-columns: 1fr;
    }
}
