@import url('https://fonts.googleapis.com/css2?family=Kanit&display=swap');

body {
    font-family: 'Kanit', sans-serif;
    background: #ffffff;
    overflow-x: hidden;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 3rem 0;
    background: linear-gradient(135deg, #2e7d32 0%, #c0a040 100%);
    border-radius: 16px;
    color: white;
    box-shadow: 0 8px 32px rgba(46, 125, 50, 0.15);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.05);
    opacity: 0.5;
}

.main-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 500;
    position: relative;
    z-index: 2;
    letter-spacing: 0.5px;
    color: #2e7d32;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.08);
    border: 1px solid rgba(46, 125, 50, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2e7d32 0%, #c0a040 100%);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(46, 125, 50, 0.15);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #2e7d32;
    margin-bottom: 0.5rem;
    display: block;
}

.stat-label {
    color: #4a5568;
    font-weight: 500;
}

.search-container {
    margin-bottom: 2rem;
    position: relative;
}

.search-box {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid rgba(44, 62, 80, 0.2);
    border-radius: 25px;
    font-size: 1.1rem;
    font-family: 'Kanit', sans-serif;
    background: white;
    box-shadow: 0 8px 32px rgba(44, 62, 80, 0.1);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 8px 32px rgba(46, 125, 50, 0.2);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 3rem;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.08);
    border: 1px solid rgba(46, 125, 50, 0.1);
    position: relative;
}

.tabs::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2e7d32 0%, #c0a040 100%);
    border-radius: 12px 12px 0 0;
}

.tab-button {
    background: #f8f9fa;
    border: 1px solid rgba(46, 125, 50, 0.15);
    color: #2e7d32;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 140px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tab-button:hover {
    background: rgba(46, 125, 50, 0.05);
    border-color: rgba(46, 125, 50, 0.3);
    transform: translateY(-1px);
}

.tab-button.active {
    background: linear-gradient(135deg, #2e7d32 0%, #c0a040 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(46, 125, 50, 0.2);
}

.department {
    display: none;
    animation: slideInUp 0.6s ease-out;
}

.department.active {
    display: block;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.department h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: 2.5rem;
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.08) 0%, rgba(192, 160, 64, 0.08) 100%);
    border-radius: 20px;
    border-left: 6px solid #2e7d32;
    position: relative;
}

.department h2 i {
    margin-right: 1rem;
    font-size: 2rem;
    background: linear-gradient(135deg, #2e7d32 0%, #c0a040 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Executive Hierarchy Styles */
.executive-hierarchy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.hierarchy-level {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
}

.hierarchy-level.with-assistant {
    justify-content: center;
    position: relative;
    max-width: 100%;
}

.main-executive {
    display: flex;
    justify-content: center;
    width: 100%;
}

.assistant-positioned {
    position: absolute;
    right: -250px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.rector-card, .vice-rector-card, .assistant-card, .director-card {
    width: 420px;
}

/* ลดขนาดเฉพาะ rector-card */
.person-card.executive.rector-card {
    width: 350px;
    padding: 1.5rem;
}
.person-card.executive.rector-card .person-photo {
    width: 140px;
    height: 180px;
    border-radius: 16px;
}

.vice-rector-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    align-items: center;
}

/* Connection Lines */
.connection-line {
    position: absolute;
    background: linear-gradient(135deg, #2e7d32 0%, #c0a040 100%);
    z-index: 1;
}

.vertical-line {
    width: 4px;
    height: 60px;
    left: 50%;
    transform: translateX(-50%);
    bottom: -60px;
}

.horizontal-line {
    height: 4px;
    width: 200px;
    top: 50%;
    transform: translateY(-50%);
}

/* Department Structure Styles */
.department-structure {
    max-width: 1400px;
    margin: 0 auto;
}

.department-head {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.sub-units {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.sub-unit {
    background: rgba(46, 125, 50, 0.02);
    border-radius: 20px;
    padding: 2rem;
    border-left: 5px solid #2e7d32;
    position: relative;
}

.sub-unit-header {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.1) 0%, rgba(192, 160, 64, 0.1) 100%);
    border-radius: 15px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid #c0a040;
}

.sub-unit-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2e7d32;
    margin: 0;
}

.sub-unit-head {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.sub-unit-staff {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Person Card Styles */
.person-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.08);
    border: 1px solid rgba(46, 125, 50, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.person-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2e7d32 0%, #c0a040 100%);
}

.person-card.executive::before {
    height: 4px;
}

.person-card.head::before {
    height: 3px;
}

.person-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(46, 125, 50, 0.15);
    border-color: rgba(46, 125, 50, 0.2);
}

.person-photo {
    width: 180px;
    height: 240px;
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    margin: 0 auto 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background-repeat: no-repeat;
}

.person-photo.executive {
    width: 180px;
    height: 240px;
    border-radius: 20px;
    margin: 0 auto 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background-repeat: no-repeat;
}

.person-card h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: 0.8rem;
}

.person-card .position {
    font-weight: 500;
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid rgba(46, 125, 50, 0.1);
}

.person-card .position.executive {
    background: rgba(192, 160, 64, 0.1);
    color: #c0a040;
    font-size: 1.1rem;
    font-weight: 600;
    border-color: rgba(192, 160, 64, 0.2);
}

.person-card .position.head {
    background: rgba(46, 125, 50, 0.1);
    color: #2e7d32;
    font-weight: 600;
    border-color: rgba(46, 125, 50, 0.2);
}

.contact-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid rgba(46, 125, 50, 0.1);
}

.contact-info p {
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    font-size: 1rem;
}

.contact-info i {
    color: #2e7d32;
    width: 20px;
    font-size: 1rem;
}

.contact-info a {
    color: #2e7d32;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.contact-info a:hover {
    color: #c0a040;
    text-decoration: underline;
}

.skills-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.skill-badge {
    background: linear-gradient(135deg, #2e7d32 0%, #c0a040 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.floating-action {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2e7d32 0%, #c0a040 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.floating-action:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(46, 125, 50, 0.4);
}

@media (max-width: 1200px) {
    .container {
        max-width: 1200px;
        padding: 1.5rem;
    }
    
    .executive-hierarchy {
        max-width: 100%;
    }
    
    .hierarchy-level.with-assistant {
        flex-direction: column;
        gap: 2rem;
        max-width: 100%;
    }
    
    .assistant-positioned {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin-top: 2rem;
    }
    
    .rector-card, .vice-rector-card, .assistant-card, .director-card {
        width: 100%;
        max-width: 420px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .main-title {
        font-size: 2.5rem;
    }

    .header {
        margin-bottom: 2rem;
        padding: 2.5rem 1rem;
    }

    .tabs {
        flex-direction: column;
        gap: 0.8rem;
    }

    .tab-button {
        flex: none;
        min-width: auto;
    }

    .sub-unit-staff {
        grid-template-columns: 1fr;
    }

    .person-card {
        padding: 2rem;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

.loading {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
    background: rgba(46, 125, 50, 0.02);
    border-radius: 15px;
    border: 2px dashed rgba(46, 125, 50, 0.2);
    margin-top: 2rem;
}

.no-results i {
    font-size: 3rem;
    color: #c0a040;
    margin-bottom: 1rem;
}

.no-results p {
    font-size: 1.1rem;
    font-weight: 500;
}

.main-content {
  background-color: #fff;
  color: #222;
  min-height: 100vh;
  padding-top: 20px;
}
/* DARK MODE */
body.dark-mode {
    background-color: #121212 !important; /* เทาเข้ม */
    color: #ddd !important;
}

body.dark-mode header,
body.dark-mode footer,
body.dark-mode .main-content {
    background-color: #1e1e1e !important; /* เทาเข้มอีกระดับ */
    color: #eee !important;
}

body.dark-mode a {
    color: #c0a040 !important;
}

body.dark-mode a:hover,
body.dark-mode a:focus {
    color: #2e7d32 !important;
}

/* Sidebar */
body.dark-mode .sidebar-v2 {
    background-color: #1e1e1e !important;
    color: #ccc !important;
    border-color: #c0a040 !important;
}

body.dark-mode .sidebar-v2 a {
    color: #ccc !important;
}

body.dark-mode .sidebar-v2 a:hover,
body.dark-mode .sidebar-v2 a:focus {
    background-color: #c0a040 !important;
    color: white !important;
}

/* Footer */
body.dark-mode .footer-container,
body.dark-mode .footer-bottom-bar {
    background-color: #121212 !important;
    color: #bbb !important;
}

/* ปรับกล่องการ์ดให้เข้ากับ dark mode */
body.dark-mode .person-card,
body.dark-mode .stat-card,
body.dark-mode .tabs,
body.dark-mode .sub-unit {
    background-color: #1e1e1e !important;
    border-color: rgba(192, 160, 64, 0.3) !important;
    color: #ddd !important;
}

body.dark-mode .person-card .position,
body.dark-mode .contact-info {
    background-color: #2a2a2a !important;
    border-color: rgba(192, 160, 64, 0.2) !important;
    color: #ccc !important;
}
