/* ============================================
   MANAGEMENT.CSS - VERSION 2.0
   ============================================ */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

html, body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
    line-height: 1.7;
    color: #2d3748;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(45, 110, 73, 0.03) 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, rgba(45, 110, 73, 0.03) 2px, transparent 2px);
    background-size: 60px 60px;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: #1a202c;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

a {
    color: #2c6e49;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #4a9d75;
}

/* Header */
header {
    background: linear-gradient(135deg, 
        rgba(255, 148, 51) 0%, 
        rgba(255, 148, 51) 100%);
    color: white;
    padding: 2.5rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 4px solid #f8c630;
}

header::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, 
        #f8c630 0%, 
        #ff6b6b 33%, 
        #4ecdc4 66%, 
        #45b7d1 100%);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, black 0%, black 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% {
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    100% {
        text-shadow: 0 2px 20px rgba(248, 198, 48, 0.4);
    }
}

.subtitle {
    font-size: 1.4rem;
    opacity: 0.95;
    font-weight: 300;
    color: rgba(0, 0, 0);
    margin-bottom: 0;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 3rem 0;
    width: 100%;
    position: relative;
    min-height: 60vh;
}

/* Management Container & Cards */
.management-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 2.5rem;
    padding: 0 2rem;
    max-width: 1400px;
    margin: 0 auto;
    perspective: 1000px;
}

.management-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-radius: 20px;
    padding: 2.5rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 
        0 10px 30px rgba(44, 110, 73, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-left: 6px solid #4a9d75;
    transform-style: preserve-3d;
    cursor: pointer;
}

.management-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.management-card:hover::before {
    transform: translateX(100%);
}

.management-card:hover {
    transform: 
        translateY(-12px) 
        rotateX(5deg) 
        rotateY(5deg);
    box-shadow: 
        0 25px 50px rgba(44, 110, 73, 0.25),
        0 10px 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    background: linear-gradient(145deg, #ffffff, #f0f9f5);
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.management-card h2 {
    font-size: 1.6rem;
    margin-bottom: 1.2rem;
    line-height: 1.4;
    font-weight: 700;
    color: #2c6e49;
    background: linear-gradient(90deg, #2c6e49, #4a9d75);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 12px;
}

.management-card h2 i {
    font-size: 1.8rem;
    opacity: 0.8;
}

.card-description {
    color: #666;
    font-size: 1rem;
    margin-top: auto;
    padding-top: 1.2rem;
    border-top: 2px dashed #e2e8f0;
    position: relative;
    line-height: 1.6;
}

.card-description::before {
    content: '→';
    position: absolute;
    right: 0;
    top: 1.2rem;
    color: #4a9d75;
    font-size: 1.2rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.management-card:hover .card-description::before {
    opacity: 1;
    transform: translateX(0);
}

/* Expertise System */
.expertise-button-container {
    max-width: 1400px;
    margin: 3rem auto;
    padding: 0 2rem;
    text-align: center;
    position: relative;
}

.expertise-main-btn {
    padding: 1.2rem 3rem;
    background: linear-gradient(135deg, 
        #2c6e49 0%, 
        #3a8c66 50%, 
        #2c6e49 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: all 0.4s ease;
    box-shadow: 
        0 8px 25px rgba(44, 110, 73, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    min-width: 300px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expertise-main-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent);
    transition: left 0.7s ease;
}

.expertise-main-btn:hover::before {
    left: 100%;
}

.expertise-main-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 15px 35px rgba(44, 110, 73, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, 
        #3a8c66 0%, 
        #2c6e49 50%, 
        #3a8c66 100%);
}

.expertise-main-btn:active {
    transform: translateY(-2px) scale(1.02);
}

/* Teacher Section */
.teacher-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.teacher-header-section {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.9));
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.teacher-header-section h2 {
    color: #2c6e49;
    font-size: 2.2rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

.teacher-header-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #2c6e49, #4a9d75);
    border-radius: 2px;
}

.teacher-header-section p {
    color: #666;
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Teacher Card */
.teacher-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 2.5rem;
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    margin-bottom: 2rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.teacher-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(to bottom, #2c6e49, #4a9d75);
    border-radius: 20px 0 0 20px;
}

.teacher-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.12);
}

.teacher-card.head-of-department {
    border: 2px solid #f8c630;
    background: linear-gradient(135deg, #ffffff 0%, #fffaf0 100%);
}

.teacher-card.head-of-department::before {
    background: linear-gradient(to bottom, #f8c630, #ffb347);
}

.teacher-avatar {
    flex-shrink: 0;
    position: relative;
}

.teacher-avatar img {
    width: 220px;
    height: 220px;
    border-radius: 15px;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
}

.teacher-card:hover .teacher-avatar img {
    transform: scale(1.05);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
}

.teacher-avatar .avatar-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #f8c630 0%, #ffb347 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 5px 15px rgba(248, 198, 48, 0.3);
    border: 2px solid white;
}

.teacher-content {
    flex: 1;
    min-width: 0;
}

.teacher-name {
    color: #2c6e49;
    font-size: 2rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 12px;
    line-height: 1.3;
}

.teacher-position {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #4a9d75 0%, #2c6e49 100%);
    color: white;
    padding: 0.8rem 1.8rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 5px 15px rgba(74, 157, 117, 0.2);
    margin-bottom: 1.5rem;
}

.teacher-card.head-of-department .teacher-position {
    background: linear-gradient(135deg, #f8c630 0%, #ffb347 100%);
    box-shadow: 0 5px 15px rgba(248, 198, 48, 0.2);
}

.teacher-contact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem;
    margin: 2rem 0;
    background: #f8fafc;
    padding: 1.8rem;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #4a5568;
    line-height: 1.6;
    font-size: 1.05rem;
}

.contact-item i {
    color: #4a9d75;
    width: 22px;
    text-align: center;
    font-size: 1.2rem;
}

.contact-item a {
    color: #2c6e49;
    font-weight: 500;
    transition: color 0.3s ease;
}

.contact-item a:hover {
    color: #4a9d75;
    text-decoration: underline;
}

.teacher-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2.5rem;
}

.expertise-btn {
    padding: 1rem 2.2rem;
    background: linear-gradient(135deg, #2c6e49 0%, #3a8c66 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    min-height: 48px;
    box-shadow: 0 5px 20px rgba(44, 110, 73, 0.2);
}

.expertise-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(44, 110, 73, 0.3);
    background: linear-gradient(135deg, #3a8c66 0%, #2c6e49 100%);
}

.expertise-btn.fullscreen-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
}

.expertise-btn.fullscreen-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

/* Popup System */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(5px);
    padding: 1.5rem;
}

.popup-overlay.active {
    display: flex;
}

.popup-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 25px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-header {
    background: linear-gradient(135deg, #2c6e49 0%, #3a8c66 100%);
    color: white;
    padding: 2rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-header h2 {
    margin: 0;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
    color: white;
    -webkit-text-fill-color: white;
    background: none;
}

.popup-header h2 i {
    color: #f8c630;
}

.popup-actions {
    display: flex;
    gap: 1rem;
}

.popup-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-content {
    padding: 2.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

.popup-image-container {
    width: 100%;
    height: 450px;
    overflow: hidden;
    border-radius: 20px;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-image-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: #4a9d75;
}

.popup-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.popup-image-container:hover .popup-image {
    transform: scale(1.02);
}

.image-preview-text {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(5px);
}

.popup-image-container:hover .image-preview-text {
    opacity: 1;
}

.image-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.nav-btn {
    flex: 1;
    padding: 1rem;
    background: linear-gradient(135deg, #4a9d75 0%, #2c6e49 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(44, 110, 73, 0.3);
}

.image-counter {
    text-align: center;
    padding: 1rem 1.8rem;
    background: #f8f9fa;
    border-radius: 15px;
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c6e49;
    border: 2px solid #e2e8f0;
    min-width: 150px;
}

.info-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.teacher-info-box, .description-box {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.teacher-info-box h3, .description-box h3 {
    color: #2c6e49;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f9f5;
}

.teacher-details {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    color: #4a5568;
    line-height: 1.7;
    font-size: 1.05rem;
}

.detail-item i {
    color: #4a9d75;
    margin-top: 3px;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.detail-item span {
    flex: 1;
}

.description-box p {
    color: #4a5568;
    line-height: 1.8;
    margin: 0;
    font-size: 1.05rem;
}

/* Fullscreen System */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.98);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.fullscreen-overlay.active {
    display: flex;
}

.fullscreen-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.fullscreen-image {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: zoomIn 0.4s ease;
}

.fullscreen-controls {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    z-index: 10001;
}

.fullscreen-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.fullscreen-info {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1.2rem 2.5rem;
    border-radius: 30px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10001;
    font-size: 1.1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.fullscreen-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    padding: 0 3rem;
    z-index: 10001;
    pointer-events: none;
}

.fullscreen-nav-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: auto;
}

.fullscreen-nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border: 5px solid rgba(243, 243, 243, 0.3);
    border-top: 5px solid #4a9d75;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10002;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   FOOTER FIXES
   ============================================ */

/* ปรับปรุงโครงสร้าง body และ flex */
body {
    font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
    line-height: 1.7;
    color: #2d3748;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
}

/* Main content ต้องใช้ flex: 1 */
.main-content {
    flex: 1 0 auto; /* สำคัญ: flex-grow: 1, flex-shrink: 0, flex-basis: auto */
    width: 100%;
    position: relative;
    min-height: auto;
    padding: 3rem 0;
}

/* ปรับปรุง Footer */
footer {
    background: linear-gradient(135deg, 
        rgba(26, 54, 93, 0.98) 0%, 
        rgba(34, 47, 62, 0.98) 100%);
    color: white;
    padding: 4rem 0 0 0;
    margin-top: auto; /* สำคัญ: ทำให้ footer อยู่ล่างสุด */
    width: 100%;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    border-top: 4px solid #f8c630;
    flex-shrink: 0; /* สำคัญ: ป้องกัน footer หดตัว */
}

/* ปรับปรุง Content ใน Footer */
.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3.5rem;
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.3);
    padding: 2.5rem;
    margin-top: 4rem;
    text-align: center;
    font-size: 1.05rem;
    opacity: 0.85;
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

/* ปรับปรุง Popup และ Overlay */
.popup-overlay,
.fullscreen-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: rgba(0, 0, 0, 0.95) !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
}

.popup-overlay.active,
.fullscreen-overlay.active {
    display: flex !important;
}

/* ป้องกันการเลื่อนเมื่อ popup เปิด */
body.no-scroll {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* ปรับปรุง Container */
.popup-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 25px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px; /* เพิ่ม margin สำหรับ mobile */
}

/* ปรับปรุง Responsive */
@media (max-width: 768px) {
    .popup-container {
        width: calc(100% - 40px);
        margin: 20px;
        max-height: 85vh;
    }
    
    .popup-content {
        max-height: calc(85vh - 120px);
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .popup-container {
        width: calc(100% - 30px);
        margin: 15px;
        max-height: 80vh;
    }
    
    .popup-content {
        max-height: calc(80vh - 110px);
        padding: 1rem;
    }
}

/* ปรับปรุง Scrollbar สำหรับ popup */
.popup-content::-webkit-scrollbar {
    width: 8px;
}

.popup-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
    margin: 5px;
}

.popup-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4a9d75, #2c6e49);
    border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2c6e49, #4a9d75);
}

/* Back to Top Button */
.back-to-top-btn {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #2c6e49 0%, #3a8c66 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 10px 30px rgba(44, 110, 73, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.back-to-top-btn:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 15px 40px rgba(44, 110, 73, 0.6);
    background: linear-gradient(135deg, #3a8c66 0%, #2c6e49 100%);
}

.back-to-top-btn:active {
    transform: translateY(-2px) scale(1.05);
}

.back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .header-content,
    .management-container,
    .teacher-section,
    .footer-content {
        max-width: 1200px;
    }
}

@media (max-width: 1200px) {
    .management-container {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        padding: 0 1.5rem;
    }
    
    .teacher-card {
        gap: 2rem;
        padding: 2rem;
    }
    
    .teacher-avatar img {
        width: 200px;
        height: 200px;
    }
    
    .popup-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .popup-image-container {
        height: 400px;
    }
}

@media (max-width: 992px) {
    html {
        font-size: 15px;
    }
    
    header h1 {
        font-size: 2.4rem;
    }
    
    .management-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .teacher-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 2rem;
    }
    
    .teacher-avatar img {
        width: 180px;
        height: 180px;
    }
    
    .teacher-contact {
        justify-content: center;
        text-align: center;
    }
    
    .contact-item {
        justify-content: center;
    }
    
    .teacher-actions {
        justify-content: center;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
    
    .popup-container {
        width: 95%;
        margin: 1rem;
    }
    
    .fullscreen-nav {
        padding: 0 1.5rem;
    }
    
    .fullscreen-nav-btn {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 2rem 0;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .management-container {
        grid-template-columns: 1fr;
        padding: 0 1rem;
        gap: 1.8rem;
    }
    
    .management-card {
        padding: 2rem;
    }
    
    .expertise-main-btn {
        min-width: auto;
        width: 100%;
        padding: 1rem 2rem;
        font-size: 1.1rem;
    }
    
    .teacher-section {
        padding: 0 1rem;
    }
    
    .teacher-card {
        padding: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    .teacher-name {
        font-size: 1.6rem;
    }
    
    .teacher-contact {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }
    
    .expertise-btn {
        width: 100%;
        justify-content: center;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-section h3::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .social-link {
        justify-content: center;
    }
    
    .popup-header {
        padding: 1.5rem;
    }
    
    .popup-header h2 {
        font-size: 1.4rem;
    }
    
    .popup-content {
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .popup-image-container {
        height: 300px;
    }
    
    .nav-btn, .image-counter {
        font-size: 0.95rem;
        padding: 0.8rem;
    }
    
    .fullscreen-controls {
        top: 1rem;
        right: 1rem;
    }
    
    .fullscreen-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .fullscreen-info {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        bottom: 1.5rem;
    }
    
    .back-to-top-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .main-content {
        padding: 2rem 0;
    }
    
    .management-card h2 {
        font-size: 1.4rem;
    }
    
    .teacher-avatar img {
        width: 160px;
        height: 160px;
    }
    
    .teacher-name {
        font-size: 1.4rem;
    }
    
    .teacher-position {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .popup-header h2 {
        font-size: 1.2rem;
    }
    
    .popup-image-container {
        height: 250px;
    }
    
    .teacher-info-box, .description-box {
        padding: 1.5rem;
    }
    
    .fullscreen-nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .footer-bottom {
        padding: 1.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .management-container {
        grid-template-columns: 1fr;
    }
    
    .management-card {
        padding: 1.5rem;
    }
    
    .expertise-main-btn {
        font-size: 1rem;
        padding: 0.8rem 1.5rem;
    }
    
    .teacher-avatar img {
        width: 140px;
        height: 140px;
    }
}

/* Print Styles */
@media print {
    .expertise-btn,
    .expertise-main-btn,
    .popup-overlay,
    .fullscreen-overlay,
    .nav-btn,
    .popup-action-btn,
    .fullscreen-btn,
    .back-to-top-btn,
    .social-links {
        display: none !important;
    }
    
    .management-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    header, footer {
        background: #f5f5f5 !important;
        color: black !important;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles for Accessibility */
:focus {
    outline: 3px solid #4a9d75;
    outline-offset: 3px;
}

button:focus,
a:focus,
input:focus {
    outline: 3px solid #4a9d75;
    outline-offset: 3px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .management-card,
    .teacher-card,
    .popup-container,
    .teacher-info-box,
    .description-box {
        border: 2px solid #000;
    }
    
    .teacher-card::before {
        width: 8px;
    }
    
    .image-counter {
        border: 2px solid #000;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a202c;
        color: #e2e8f0;
    }
    
    .management-card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .teacher-card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .teacher-contact {
        background: #4a5568;
        border-color: #718096;
    }
    
    .popup-container {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .teacher-info-box,
    .description-box {
        background: #4a5568;
        border-color: #718096;
    }
    
    .popup-image-container {
        background: #4a5568;
        border-color: #718096;
    }
    
    .contact-item a {
        color: #90cdf4;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4a9d75, #2c6e49);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2c6e49, #4a9d75);
}

/* Selection */
::selection {
    background: rgba(74, 157, 117, 0.3);
    color: #2c6e49;
}

::-moz-selection {
    background: rgba(74, 157, 117, 0.3);
    color: #2c6e49;
}