/* Premium Aesthetics for Administration Page */
:root {
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --accent-blue: #3b82f6;
    --accent-indigo: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-violet: #a855f7;
    --accent-pink: #ec4899;
    --accent-amber: #f59e0b;
    --accent-teal: #0f766e;
    
    --bg-light: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(226, 232, 240, 0.8);
    --glass-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04);
    
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --card-hover-shadow: 0 20px 35px -10px rgba(16, 185, 129, 0.12);
    
    --radius-premium: 24px;
    --radius-card: 18px;
    --radius-badge: 30px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Page Container */
.organization-page {
    background-color: var(--bg-light);
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.03) 0px, transparent 50%);
    min-height: 100vh;
    padding: 60px 0;
}

.org-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Section */
.org-header {
    margin-bottom: 50px;
}

.org-title {
    font-size: 2.8rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin-top: 15px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.org-subtitle {
    color: #64748b;
    font-size: 1.15rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.section-tag {
    display: inline-block;
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    border-radius: var(--radius-badge);
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Controls Glasscard (Search & Filter) */
.controls-glasscard {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-premium);
    padding: 24px;
    box-shadow: var(--glass-shadow);
}

/* Search Box */
.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.employee-search {
    width: 100%;
    padding: 14px 45px 14px 48px;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b;
    background: #ffffff;
    transition: var(--transition-smooth);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01);
}

.employee-search:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.employee-search:focus + .search-icon {
    color: #10b981;
}

.clear-search-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-smooth);
}

.clear-search-btn:hover {
    color: #ef4444;
    transform: translateY(-50%) scale(1.1);
}

/* Tab Filters */
.filter-tabs-wrapper {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.filter-tab {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-tab:hover {
    border-color: #cbd5e1;
    color: #1e293b;
    background: #f8fafc;
}

.filter-tab.active {
    background: #10b981;
    border-color: #10b981;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.search-feedback-text {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Tab Sections */
.tab-content-section {
    animation: fadeInSection 0.5s ease-out;
}

@keyframes fadeInSection {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.category-heading {
    font-size: 1.8rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1.5px dashed #cbd5e1;
    padding-bottom: 14px;
}

.category-heading span {
    font-size: 2rem;
}

/* Leadership Row */
.leadership-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

/* Cards Premium */
.card-premium {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-premium);
    padding: 30px 24px;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    cursor: default;
    opacity: 0;
    transform: translateY(20px);
}

.card-premium.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.card-premium:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-hover-shadow);
    border-color: rgba(16, 185, 129, 0.2);
}

.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition-smooth);
}

.card-premium:hover .card-glow {
    opacity: 1;
}

/* Role Specific Glow Override */
.director-card .card-glow { background: linear-gradient(135deg, #f59e0b 0%, #ca8a04 100%); }
.deputy-card .card-glow { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.secretary-card .card-glow { background: linear-gradient(135deg, #d946ef 0%, #a21caf 100%); }

.director-card:hover { border-color: rgba(245, 158, 11, 0.2); box-shadow: 0 20px 35px -10px rgba(245, 158, 11, 0.12); }
.deputy-card:hover { border-color: rgba(99, 102, 241, 0.2); box-shadow: 0 20px 35px -10px rgba(99, 102, 241, 0.12); }
.secretary-card:hover { border-color: rgba(217, 70, 239, 0.2); box-shadow: 0 20px 35px -10px rgba(217, 70, 239, 0.12); }

/* Avatar System */
.avatar-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
    margin-bottom: 20px;
    z-index: 1;
}

.employee-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    transition: var(--transition-smooth);
}

.card-premium:hover .employee-avatar-img {
    transform: scale(1.05);
}

.employee-avatar-initials {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 2.1rem;
    letter-spacing: -0.02em;
    transition: var(--transition-smooth);
}

.card-premium:hover .employee-avatar-initials {
    transform: scale(1.05) rotate(2deg);
}

/* Gradient Roles Map */
.employee-avatar-initials.grade-director { background: linear-gradient(135deg, #f59e0b 0%, #ca8a04 100%); }
.employee-avatar-initials.grade-deputy { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.employee-avatar-initials.grade-secretary { background: linear-gradient(135deg, #d946ef 0%, #a21caf 100%); }
.employee-avatar-initials.grade-head { background: linear-gradient(135deg, #0d9488 0%, #115e59 100%); }
.employee-avatar-initials.grade-researcher { background: linear-gradient(135deg, #10b981 0%, #047857 100%); }
.employee-avatar-initials.grade-staff { background: linear-gradient(135deg, #64748b 0%, #475569 100%); }

.role-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Card details styling */
.employee-name-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
    line-height: 1.3;
}

.employee-role-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 12px;
}

.dept-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #f1f5f9;
    border-radius: var(--radius-badge);
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
}

/* Email button */
.email-btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    transition: var(--transition-smooth);
    max-width: 100%;
}

.email-btn-modern span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-btn-modern:hover {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.3);
    color: #059669;
}

.email-btn-modern svg {
    flex-shrink: 0;
}

/* Department Glass Container */
.dept-container-glass {
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-premium);
    box-shadow: var(--card-shadow);
    padding: 30px;
    overflow: hidden;
}

.dept-glass-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 20px;
}

.dept-icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: rgba(16, 185, 129, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.dept-glass-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 2px;
}

.dept-glass-subtitle {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

.staff-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 24px;
}

/* Head card highlighted styling */
.employee-card.highlighted-border {
    border-color: rgba(16, 185, 129, 0.25);
    background: linear-gradient(to bottom, rgba(16, 185, 129, 0.01), #ffffff 25%);
}

.employee-card.highlighted-border::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 45px 45px 0;
    border-color: transparent #10b981 transparent transparent;
    z-index: 2;
}

/* Branch Specific Cards Styling */
.branch-glass-card {
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-premium);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.branch-glass-header-bar {
    background: linear-gradient(90deg, #f8fafc 0%, #ffffff 100%);
    padding: 24px 30px;
    border-bottom: 1.5px dashed #e2e8f0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.branch-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.branch-card-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
    line-height: 1.35;
}

.branch-location-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #3b82f6;
    margin: 0;
}

.branch-inner-subtitle {
    font-size: 1rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
    border-left: 3.5px solid #3b82f6;
    padding-left: 10px;
}

/* Nested Branch Sub Departments */
.sub-dept-label-heading {
    font-size: 1.05rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 16px;
    background: #f1f5f9;
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
}

/* Search Highlights */
.highlight-match {
    animation: flashHighlight 0.6s ease-out;
    border-color: #10b981 !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15) !important;
}

@keyframes flashHighlight {
    0% { transform: scale(0.98); border-color: #10b981; }
    50% { transform: scale(1.02); border-color: #3b82f6; }
    100% { transform: scale(1); border-color: #10b981; }
}

.fade-out {
    opacity: 0.2;
    filter: blur(1px);
}

/* Responsiveness */
@media (max-width: 992px) {
    .filter-tabs-wrapper {
        justify-content: flex-start;
        margin-top: 15px;
    }
}

@media (max-width: 768px) {
    .org-title {
        font-size: 2.2rem;
    }
    
    .dept-container-glass, .branch-glass-card {
        padding: 20px;
    }
    
    .branch-glass-header-bar {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .branch-main-staff-list {
        padding: 15px 0 !important;
    }
    
    .branch-sub-departments {
        padding: 10px 0 !important;
    }
}

@media (max-width: 576px) {
    .org-title {
        font-size: 1.8rem;
    }
    
    .employee-card {
        padding: 24px 16px;
    }
    
    .staff-grid-modern {
        grid-template-columns: 1fr;
    }
    
    .leadership-row {
        grid-template-columns: 1fr;
    }
    
    .filter-tabs-wrapper {
        gap: 6px;
    }
    
    .filter-tab {
        padding: 8px 14px;
        font-size: 0.85rem;
        flex: 1 1 45%;
        text-align: center;
    }
}
