/* ===========================
   PROFILE.CSS
   Profile page specific styles
   - Profile layout
   - Sidebar
   - Statistics cards
   - Tabs
   - Data tables (academic, grants, publication, etc.)
   - Charts
=========================== */

/* ===========================
   Profile Page Background
=========================== */
body.profile-page-body {
    background: #E7EFFF;
}

/* ===========================
   Profile Page Layout
=========================== */
.profile-page {
    display: flex;
    gap: 20px;
    padding: 10px;
    padding-bottom: 50px;
    flex-wrap: wrap;
    align-items: flex-start;
}

@media (max-width: 992px) {
    .profile-page {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
}

/* ===========================
   Profile Sidebar
=========================== */
.profile-sidebar {
    flex: 0 0 auto;
    max-width: 300px;
    background: linear-gradient(to bottom, #fafafa, #eaeaea);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: left;
}

@media (max-width: 992px) {
    .profile-sidebar {
        max-width: 100%;
        text-align: center;
    }

    .profile-sidebar img {
        margin: 0 auto;
    }
}

.profile-sidebar h3 {
    font-size: 22px;
    color: #000066;
    margin: 0 0 5px 0;
}

.profile-sidebar p {
    margin: 5px 0;
    font-size: 0.95rem;
}

/* Profile Picture */
.profile-pic {
    width: 150px;
    height: 150px;
    object-fit: cover;
    object-position: top;
    border-radius: 50%;
    border: 3px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: block;
    margin: 0 auto 15px;
}

/* Name & Title */
.name-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
    text-align: center;
    color: #082E72;
}

/* Email */
.email {
    text-align: center;
    display: block;
    text-transform: none;
}

.email a {
    color: #0077cc;
    text-decoration: none;
    margin-bottom: 5px;
    font-weight: bold;
    text-transform: lowercase;
}

.email a:hover {
    text-decoration: underline;
}

.center-info p {
    margin-bottom: 12px;
    line-height: 1.3;
    text-align: center;
    font-size: 0.9rem;
}

.center-info p strong {
    color: #333;
    font-weight: 700;
    display: inline;
    margin-bottom: 0;
}

.center-info p br {
    display: none;
}

/* Allow br in position for multi-line display */
.center-info p#position br {
    display: inline;
}

.center-info p strong::after {
    content: '\A';
    white-space: pre;
}

.center-info a {
    color: #0077cc;
    text-decoration: underline;
    word-break: break-all;
}

.center-info a:hover {
    color: #005fa3;
}

.center-info span {
    color: #082E72;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
}

/* Profile Main Content */
.profile-main {
    flex: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===========================
   Statistics Cards
=========================== */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    width: 100%;
}

@media (max-width: 1200px) {
    .profile-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .profile-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.profile-stats .stat-card {
    padding: 20px 10px 5px 10px;
    border-radius: 8px;
    text-align: center;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Stat card colors */
.profile-stats .stat-card:nth-child(1) { background: #007bff; }
.profile-stats .stat-card:nth-child(2) { background: #28a745; }
.profile-stats .stat-card:nth-child(3) { background: #ffaf04; }
.profile-stats .stat-card:nth-child(4) { background: #c52fb9; }
.profile-stats .stat-card:nth-child(5) { background: #2435b3; }
.profile-stats .stat-card:nth-child(6) { background: #6f42c1; }
.profile-stats .stat-card:nth-child(7) { background: #15c9c7; }
.profile-stats .stat-card:nth-child(8) { background: #7b0458; }

.profile-stats .stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.profile-stats .stat-card p {
    margin: 0;
    font-size: 36px;
    font-weight: 800;
}

.profile-stats .stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

/* ===========================
   Tabs Navigation
=========================== */
.profile-tabs {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.tab-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 2px solid #ddd;
    background: #f9f9f9;
    flex-wrap: wrap;
}

.tab-nav-item {
    padding: 6px 10px;
    cursor: pointer;
    background: #f0f0f0;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    border-right: 1px solid #ccc;
    border-radius: 6px 6px 0 0;
    flex: 1 1 auto;
    text-align: center;
    min-width: 70px;
    transition: background 0.3s, color 0.3s;
}

.tab-nav-item:last-child {
    border-right: none;
}

.tab-nav-item:focus {
    outline: 3px solid #007bff;
    outline-offset: -3px;
    background: #e3f2fd;
    color: #0056b3;
}

.tab-nav-item:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: -3px;
}

.tab-nav-item:hover {
    background: #007bff;
    color: #fff;
}

.tab-nav-item.active {
    background: #0056b3;
    color: #fff;
}

/* Mobile scrollable tabs */
@media (max-width: 768px) {
    .profile-tabs {
        overflow: hidden;
    }

    .tab-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scroll-behavior: smooth;
    }

    .tab-nav::-webkit-scrollbar {
        height: 4px;
    }

    .tab-nav::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .tab-nav::-webkit-scrollbar-thumb {
        background: #007bff;
        border-radius: 2px;
    }

    .tab-nav-item {
        flex: 0 0 auto;
        white-space: nowrap;
        min-width: auto;
        padding: 8px 12px;
    }
}

/* Tab Content */
.tab-content {
    padding: 15px 20px;
}

.tab-table {
    padding: 15px 0;
    margin: 10px 0;
}

#tab-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===========================
   Table Containers & Controls
=========================== */
.table-box {
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    padding: 16px 10px 5px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.table-box2 {
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    padding: 16px 10px 5px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

/* ===========================
   Table Base Styles
=========================== */
.table-box .table,
.table-box2 .table {
    --bs-table-color: #333;
    --bs-table-bg: transparent;
    --bs-table-border-color: #dee2e6;
    --bs-table-accent-bg: transparent;
    --bs-table-striped-color: #333;
    --bs-table-striped-bg: rgba(0, 0, 0, 0.02);
    --bs-table-hover-color: #333;
    --bs-table-hover-bg: rgba(0, 139, 139, 0.05);
    
    width: 100%;
    margin-bottom: 0;
    vertical-align: middle;
    border-color: var(--bs-table-border-color);
    border-collapse: collapse;
}

.table-box .table > :not(caption) > * > *,
.table-box2 .table > :not(caption) > * > * {
    padding: 12px 15px;
    color: var(--bs-table-color);
    background-color: var(--bs-table-bg);
    border-bottom-width: 1px;
    box-shadow: none;
}

.table-box .table > tbody,
.table-box2 .table > tbody {
    vertical-align: inherit;
}

.table-box .table > thead,
.table-box2 .table > thead {
    vertical-align: bottom;
}

/* Table Small - Condensed */
.table-box .table.table-sm > :not(caption) > * > *,
.table-box2 .table.table-sm > :not(caption) > * > * {
    padding: 8px 10px;
}

/* Table Hover Effect */
.table-box .table.table-hover > tbody > tr:hover > *,
.table-box2 .table.table-hover > tbody > tr:hover > * {
    --bs-table-color-state: var(--bs-table-hover-color);
    --bs-table-bg-state: var(--bs-table-hover-bg);
    background-color: var(--bs-table-hover-bg);
}

/* Table Borderless */
.table-box .table.table-borderless > :not(caption) > * > *,
.table-box2 .table.table-borderless > :not(caption) > * > * {
    border-bottom-width: 0;
}

/* Table Striped */
.table-box .table.table-striped > tbody > tr:nth-of-type(odd) > *,
.table-box2 .table.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--bs-table-striped-bg);
}

/* Table Light Variant */
.table-light {
    --bs-table-color: #000;
    --bs-table-bg: #f8f9fa;
    --bs-table-border-color: #c6c7c8;
    --bs-table-striped-bg: #ecedee;
    --bs-table-striped-color: #000;
    --bs-table-active-bg: #dfe0e1;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #e5e6e7;
    --bs-table-hover-color: #000;
    color: var(--bs-table-color);
    border-color: var(--bs-table-border-color);
}

/* ===========================
   Clean Table Design - Override Bootstrap
===========================*/
.table-box .table thead,
.table-box2 .table thead,
.table-box .table thead.table-light,
.table-box2 .table thead.table-light {
    --bs-table-bg: transparent !important;
    --bs-table-color: #008B8B !important;
    border: none !important;
}

.table-box .table th,
.table-box2 .table th,
.table-box .table thead th,
.table-box2 .table thead th,
.table-box .table-light th,
.table-box2 .table-light th,
.table-box .table > thead > tr > th,
.table-box2 .table > thead > tr > th {
    background-color: transparent !important;
    background: transparent !important;
    border: none !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: 2px solid #ddd !important;
    font-weight: 600;
    color: #008B8B !important;
    text-transform: uppercase;
    font-size: 13px;
    padding: 12px 15px;
}

.table-box .table-light,
.table-box2 .table-light {
    --bs-table-bg: transparent !important;
    --bs-table-color: #008B8B !important;
    background: transparent !important;
}

.table-box .table td,
.table-box2 .table td,
.table-box .table > tbody > tr > td,
.table-box2 .table > tbody > tr > td {
    border: none !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: 1px solid #eee !important;
    padding: 12px 15px;
    color: #333;
    font-size: 14px;
    vertical-align: middle;
    background: transparent !important;
}

.table-box .table tbody tr:last-child td,
.table-box2 .table tbody tr:last-child td {
    border-bottom: none !important;
}

.table-box .table tbody tr:hover td,
.table-box2 .table tbody tr:hover td {
    background-color: rgba(0, 139, 139, 0.05) !important;
}

.table-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.table-controls {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    text-align: right;
}

.table-controls input[type="text"] {
    padding: 8px 14px 8px 38px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    transition: 0.3s;
    background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="%23999" viewBox="0 0 24 24"><path d="M21.53 20.47l-4.68-4.68A7.92 7.92 0 0018 10a8 8 0 10-8 8 7.92 7.92 0 005.79-1.15l4.68 4.68a.75.75 0 101.06-1.06zM4.5 10a5.5 5.5 0 1111 0 5.5 5.5 0 01-11 0z"></path></svg>') no-repeat;
    background-size: 18px;
    background-position: 10px center;
}

.table-controls input[type="text"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.25);
}

.table-controls select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: 0.3s;
}

.table-controls select:hover {
    border-color: #007bff;
}

/* ===========================
   GRANTS TAB - Table Styling
=========================== */
#tableBoxGrants .table,
#tableBoxConsultancy .table,
#tableBoxCommunity .table {
    table-layout: fixed;
    width: 100%;
}

#tableBoxGrants .table th,
#tableBoxConsultancy .table th,
#tableBoxCommunity .table th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tableBoxGrants .table td,
#tableBoxConsultancy .table td,
#tableBoxCommunity .table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: top;
}

/* Year column - center aligned */
#tableBoxGrants .table td:first-child,
#tableBoxConsultancy .table td:first-child,
#tableBoxCommunity .table td:first-child {
    text-align: center;
}

/* Title column - allow wrapping */
#tableBoxGrants .table td:nth-child(2),
#tableBoxConsultancy .table td:nth-child(2),
#tableBoxCommunity .table td:nth-child(2) {
    line-height: 1.4;
}

/* Amount column - center aligned for Grants (4th col) */
#tableBoxGrants .table td:nth-child(4) {
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
}

/* Role column - center aligned for all grant tables (5th col) */
#tableBoxGrants .table th:nth-child(5),
#tableBoxConsultancy .table th:nth-child(5),
#tableBoxCommunity .table th:nth-child(5),
#tableBoxGrants .table td:nth-child(5),
#tableBoxConsultancy .table td:nth-child(5),
#tableBoxCommunity .table td:nth-child(5) {
    text-align: center;
}

/* Amount column - center aligned for Consultancy and Community (4th col) */
#tableBoxConsultancy .table td:nth-child(4),
#tableBoxCommunity .table td:nth-child(4) {
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
}

/* Table Search */
.table-search {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.table-search label {
    font-weight: 500;
    font-size: 1rem;
    color: #333;
}

.table-search input[type="text"] {
    width: 250px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.3s ease;
}

.table-search input[type="text"]::placeholder {
    color: #aaa;
    font-style: italic;
}

.table-search input[type="text"]:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 5px rgba(26, 115, 232, 0.3);
}

@media (max-width: 576px) {
    .table-search {
        flex-direction: column;
        align-items: flex-end;
    }

    .table-search label {
        margin-bottom: 0.3rem;
    }

    .table-search input[type="text"] {
        width: 100%;
    }
}

/* ===========================
   Academic Qualification Table
=========================== */
.academic-quality,
.table-box table {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 14px;
}

.academic-quality th,
@media (max-width: 480px) {
    .academic-quality thead { display: none; }
    .academic-quality tbody td {
        display: block;
        padding: 8px 12px;
        border-bottom: 1px solid #e6eef8;
    }
    .academic-quality tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        width: 120px;
        display: inline-block;
        color: #0b63d6;
    }
}

/* ===========================
   Academic Table (Teaching)
=========================== */
.academic-table {
    width: auto;
    max-width: 1000px;
    border-collapse: collapse;
    font-size: 14px;
}

.academic-table th,
.academic-table td {
    border: 1px solid #333;
    padding: 8px 12px;
    text-align: left;
}

.academic-table th {
    background-color: #E1FFFD;
    font-weight: 600;
}

.academic-table tbody tr:nth-child(odd) { background-color: #F3FFFE; }
.academic-table tbody tr:nth-child(even) { background-color: #ECFFFD; }

.academic-table td:nth-child(1),
.academic-table th:nth-child(1) {
    text-align: center !important;
}

@media (max-width: 480px) {
    .academic-table thead { display: none; }
    .academic-table tbody td {
        display: block;
        padding: 8px 12px;
        border-bottom: 1px solid #e6eef8;
    }
    .academic-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        width: 120px;
        display: inline-block;
        color: #0b63d6;
    }
}

/* ===========================
   Grants Table
=========================== */
.grants-table {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

.grants-table th,
.grants-table td {
    border: 1px solid #333;
    padding: 5px 5px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.grants-table th {
    background-color: #E1FFFD;
    font-weight: 600;
}

.grants-table tbody tr:nth-child(odd) { background-color: #F3FFFE; }
.grants-table tbody tr:nth-child(even) { background-color: #ECFFFD; }

.grants-table td:nth-child(1),
.grants-table th:nth-child(1) {
    text-align: center !important;
}

.grants-table td:nth-child(4),
.grants-table th:nth-child(4),
.grants-table td:nth-child(5),
.grants-table th:nth-child(5) {
    text-align: center !important;
}

.grants-table td:nth-child(2),
.grants-table th:nth-child(2) {
    width: 500px;
}

/* ===========================
   Grants Category Tables (5 tables)
   Standardized column widths
=========================== */
#tableBoxInternational .table,
#tableBoxNational .table,
#tableBoxUTeM .table,
#tableBoxCommercialization .table,
#tableBoxIndustry .table {
    table-layout: fixed;
    width: 100%;
}

/* YEAR AWARDED - 10% */
#tableBoxInternational .table th:nth-child(1),
#tableBoxInternational .table td:nth-child(1),
#tableBoxNational .table th:nth-child(1),
#tableBoxNational .table td:nth-child(1),
#tableBoxUTeM .table th:nth-child(1),
#tableBoxUTeM .table td:nth-child(1),
#tableBoxCommercialization .table th:nth-child(1),
#tableBoxCommercialization .table td:nth-child(1),
#tableBoxIndustry .table th:nth-child(1),
#tableBoxIndustry .table td:nth-child(1) {
    width: 10%;
    text-align: center;
}

/* TITLE OF PROJECT - 40% */
#tableBoxInternational .table th:nth-child(2),
#tableBoxInternational .table td:nth-child(2),
#tableBoxNational .table th:nth-child(2),
#tableBoxNational .table td:nth-child(2),
#tableBoxUTeM .table th:nth-child(2),
#tableBoxUTeM .table td:nth-child(2),
#tableBoxCommercialization .table th:nth-child(2),
#tableBoxCommercialization .table td:nth-child(2),
#tableBoxIndustry .table th:nth-child(2),
#tableBoxIndustry .table td:nth-child(2) {
    width: 40%;
    text-align: left;
}

/* TYPE OF GRANT - 18% */
#tableBoxInternational .table th:nth-child(3),
#tableBoxInternational .table td:nth-child(3),
#tableBoxNational .table th:nth-child(3),
#tableBoxNational .table td:nth-child(3),
#tableBoxUTeM .table th:nth-child(3),
#tableBoxUTeM .table td:nth-child(3),
#tableBoxCommercialization .table th:nth-child(3),
#tableBoxCommercialization .table td:nth-child(3),
#tableBoxIndustry .table th:nth-child(3),
#tableBoxIndustry .table td:nth-child(3) {
    width: 18%;
    text-align: center;
}

/* AMOUNT (RM) - 12% */
#tableBoxInternational .table th:nth-child(4),
#tableBoxInternational .table td:nth-child(4),
#tableBoxNational .table th:nth-child(4),
#tableBoxNational .table td:nth-child(4),
#tableBoxUTeM .table th:nth-child(4),
#tableBoxUTeM .table td:nth-child(4),
#tableBoxCommercialization .table th:nth-child(4),
#tableBoxCommercialization .table td:nth-child(4),
#tableBoxIndustry .table th:nth-child(4),
#tableBoxIndustry .table td:nth-child(4) {
    width: 12%;
    text-align: center;
}

/* ROLE - 13% */
#tableBoxInternational .table th:nth-child(5),
#tableBoxInternational .table td:nth-child(5),
#tableBoxNational .table th:nth-child(5),
#tableBoxNational .table td:nth-child(5),
#tableBoxUTeM .table th:nth-child(5),
#tableBoxUTeM .table td:nth-child(5),
#tableBoxCommercialization .table th:nth-child(5),
#tableBoxCommercialization .table td:nth-child(5),
#tableBoxIndustry .table th:nth-child(5),
#tableBoxIndustry .table td:nth-child(5) {
    width: 13%;
    text-align: left;
}

@media (max-width: 480px) {
    .grants-table thead { display: none; }
    .grants-table tbody td {
        display: block;
        padding: 8px 12px;
        border-bottom: 1px solid #e6eef8;
    }
    .grants-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        width: 120px;
        display: inline-block;
        color: #0b63d6;
    }
}

/* Grants Chart Section - Side by Side Layout */
#grantsChartSection {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

#grantsChartSection[style*="display: flex"],
#grantsChartSection:not([style*="display: none"]) {
    display: flex;
}

/* Awards Chart Section */
#awardsChartSection {
    justify-content: center;
    align-items: flex-start;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

#awardsChartSection[style*="display: flex"],
#awardsChartSection:not([style*="display: none"]) {
    display: flex;
}

#awardsChartSection canvas {
    max-height: 280px !important;
}

#grantsChartSection > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

#grantsChartSection > div:last-child {
    flex: 0 0 280px;
    min-width: 280px;
}

/* Supervision Chart Section - Side by Side Layout */
#supervisionChartSection {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

#supervisionChartSection[style*="display: flex"],
#supervisionChartSection:not([style*="display: none"]) {
    display: flex;
}

#supervisionChartSection > div {
    flex: 1 1 0;
    min-width: 0;
    max-width: 450px;
}

#supervisionChartSection canvas {
    max-height: 280px !important;
}

/* Intellectual Properties Chart Section - Side by Side Layout */
#intProChartSection {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

#intProChartSection[style*="display: flex"],
#intProChartSection:not([style*="display: none"]) {
    display: flex;
}

#intProChartSection > div {
    flex: 1 1 0;
    min-width: 0;
    max-width: 400px;
}

#intProChartSection canvas {
    max-height: 280px !important;
}

/* Total text for grants */
.total-text {
    text-align: center;
    font-size: 38px;
    font-weight: 800;
    color: #1104A4;
    margin: 10px 0;
    line-height: 1.2;
}

/* ===========================
   Publication Table
=========================== */
.publication-table {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

.publication-table th,
.publication-table td {
    border: 1px solid #333;
    padding: 5px 5px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.publication-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.publication-table tbody tr:nth-child(odd) { background-color: #fff; }
.publication-table tbody tr:nth-child(even) { background-color: #fbfbfb; }

.publication-table td:nth-child(1),
.publication-table th:nth-child(1) {
    width: 60px;
    min-width: 60px;
    text-align: center !important;
}

/* ===========================
   Publication Category Tables (3 tables)
   Standardized column widths
=========================== */
#tableBoxJournal .table,
#tableBoxProceeding .table,
#tableBoxBook .table {
    table-layout: fixed;
    width: 100%;
}

/* YEAR - 8% */
#tableBoxJournal .table th:nth-child(1),
#tableBoxJournal .table td:nth-child(1),
#tableBoxProceeding .table th:nth-child(1),
#tableBoxProceeding .table td:nth-child(1),
#tableBoxBook .table th:nth-child(1),
#tableBoxBook .table td:nth-child(1) {
    width: 8%;
    text-align: center;
}

/* TITLE - 40% */
#tableBoxJournal .table th:nth-child(2),
#tableBoxJournal .table td:nth-child(2),
#tableBoxProceeding .table th:nth-child(2),
#tableBoxProceeding .table td:nth-child(2),
#tableBoxBook .table th:nth-child(2),
#tableBoxBook .table td:nth-child(2) {
    width: 40%;
    text-align: left;
}

/* NAME OF JOURNAL/PROCEEDING/SOURCE - 27% */
#tableBoxJournal .table th:nth-child(3),
#tableBoxJournal .table td:nth-child(3),
#tableBoxProceeding .table th:nth-child(3),
#tableBoxProceeding .table td:nth-child(3),
#tableBoxBook .table th:nth-child(3),
#tableBoxBook .table td:nth-child(3) {
    width: 27%;
    text-align: left;
}

/* AUTHORS/TYPE - 25% */
#tableBoxJournal .table th:nth-child(4),
#tableBoxJournal .table td:nth-child(4),
#tableBoxProceeding .table th:nth-child(4),
#tableBoxProceeding .table td:nth-child(4),
#tableBoxBook .table th:nth-child(4),
#tableBoxBook .table td:nth-child(4) {
    width: 25%;
    text-align: left;
}

@media (max-width: 480px) {
    .publication-table thead { display: none; }

    .publication-table tbody td {
        display: flex;
        justify-content: flex-start;
        padding: 6px 8px;
        border-bottom: 1px solid #e6eef8;
    }

    .publication-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        flex: 0 0 80px;
        width: 80px;
        color: #0b63d6;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .publication-table tbody td span {
        flex: 1;
        display: inline-block;
    }
}

/* ===========================
   Conference Table
=========================== */
.conference-table {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

.conference-table th,
.conference-table td {
    border: 1px solid #333;
    padding: 5px 5px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.conference-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.conference-table tbody tr:nth-child(odd) { background-color: #fff; }
.conference-table tbody tr:nth-child(even) { background-color: #fbfbfb; }

.conference-table td:nth-child(1),
.conference-table th:nth-child(1) {
    width: 60px;
    min-width: 60px;
    text-align: center !important;
}

@media (max-width: 480px) {
    .conference-table thead { display: none; }

    .conference-table tbody td {
        display: flex;
        justify-content: flex-start;
        padding: 6px 8px;
        border-bottom: 1px solid #e6eef8;
    }

    .conference-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        flex: 0 0 80px;
        width: 80px;
        color: #0b63d6;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .conference-table tbody td span {
        flex: 1;
        display: inline-block;
    }
}

/* ===========================
   Student Table
=========================== */
.student-table {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

.student-table th,
.student-table td {
    border: 1px solid #333;
    padding: 5px 5px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.student-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.student-table tbody tr:nth-child(odd) { background-color: #fff; }
.student-table tbody tr:nth-child(even) { background-color: #fbfbfb; }

.student-table th:nth-child(1),
.student-table td:nth-child(1) {
    width: 30px;
    min-width: 30px;
    text-align: center;
}

@media (max-width: 480px) {
    .student-table thead { display: none; }

    .student-table tbody td {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        padding: 6px 8px;
        border-bottom: 1px solid #e6eef8;
    }

    .student-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        flex: 0 0 50px;
        width: 50px;
        color: #0b63d6;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-right: 8px;
    }

    .student-table tbody td span {
        flex: 1;
        display: inline-block;
        min-width: 0;
    }
}

/* ===========================
   Membership Table
=========================== */
.membership-table {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

.membership-table th,
.membership-table td {
    border: 1px solid #333;
    padding: 5px 5px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.membership-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.membership-table tbody tr:nth-child(odd) { background-color: #fff; }
.membership-table tbody tr:nth-child(even) { background-color: #fbfbfb; }

.membership-table td:nth-child(1),
.membership-table th:nth-child(1) {
    width: 60px;
    min-width: 60px;
    white-space: nowrap;
    text-align: center !important;
}

.membership-table td:last-child,
.membership-table th:last-child {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .membership-table thead { display: none; }

    .membership-table tbody td {
        display: flex;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 6px 8px;
        border-bottom: 1px solid #e6eef8;
    }

    .membership-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        flex: 0 0 90px;
        width: 90px;
        color: #0b63d6;
        white-space: nowrap;
    }

    .membership-table tbody td span {
        flex: 1;
        display: inline-block;
        word-break: break-word;
    }

    .membership-table tbody td:first-child,
    .membership-table tbody td:last-child {
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .membership-table tbody td:first-child::before,
    .membership-table tbody td:last-child::before {
        content: "" !important;
        display: none !important;
    }
}

/* ===========================
   Award Table
=========================== */
.award-table {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

.award-table th,
.award-table td {
    border: 1px solid #333;
    padding: 5px 5px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.award-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.award-table tbody tr:nth-child(odd) { background-color: #fff; }
.award-table tbody tr:nth-child(even) { background-color: #fbfbfb; }

.award-table td:nth-child(1),
.award-table th:nth-child(1) {
    width: 60px;
    min-width: 60px;
    white-space: nowrap;
    text-align: center !important;
}

.award-table td:nth-last-child(-n+2),
.award-table th:nth-last-child(-n+2) {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .award-table thead { display: none; }

    .award-table tbody td {
        display: flex;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 6px 8px;
        border-bottom: 1px solid #e6eef8;
    }

    .award-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        flex: 0 0 90px;
        width: 90px;
        color: #0b63d6;
        white-space: nowrap;
    }

    .award-table tbody td span {
        flex: 1;
        display: inline-block;
        word-break: break-word;
    }

    .award-table tbody td:first-child {
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 60px;
    }

    .award-table tbody td:nth-last-child(2),
    .award-table tbody td:last-child {
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .award-table tbody td:first-child::before,
    .award-table tbody td:nth-last-child(2)::before,
    .award-table tbody td:last-child::before {
        content: "" !important;
        display: none !important;
    }
}

/* ===========================
   Intellectual Property Table
=========================== */
.intellectual-table {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
}

.intellectual-table th,
.intellectual-table td {
    border: 1px solid #333;
    padding: 5px 5px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.intellectual-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.intellectual-table tbody tr:nth-child(odd) { background-color: #fff; }
.intellectual-table tbody tr:nth-child(even) { background-color: #fbfbfb; }

.intellectual-table td:nth-child(1),
.intellectual-table th:nth-child(1) {
    width: 60px;
    min-width: 60px;
    white-space: nowrap;
    text-align: center !important;
}

.intellectual-table td:last-child,
.intellectual-table th:last-child {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .intellectual-table thead { display: none; }

    .intellectual-table tbody td {
        display: flex;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 6px 8px;
        border-bottom: 1px solid #e6eef8;
    }

    .intellectual-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        flex: 0 0 90px;
        width: 90px;
        color: #0b63d6;
        white-space: nowrap;
    }

    .intellectual-table tbody td span {
        flex: 1;
        display: inline-block;
        word-break: break-word;
    }

    .intellectual-table tbody td:nth-child(2) span,
    .intellectual-table tbody td:nth-child(3) span {
        white-space: normal;
    }

    .intellectual-table tbody td:first-child,
    .intellectual-table tbody td:last-child {
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .intellectual-table tbody td:first-child::before,
    .intellectual-table tbody td:last-child::before {
        content: "" !important;
        display: none !important;
    }
}

/* ===========================
   Large Table (Joint Project)
=========================== */
.large-table table {
    font-size: 14px;
}

.large-table th,
.large-table td {
    padding: 0.75rem 1rem;
}

.large-table tbody tr {
    height: 50px;
}

.large-table {
    overflow-x: auto;
}

.large-table td:nth-child(1),
.large-table th:nth-child(1),
.large-table td:nth-child(3),
.large-table td:nth-child(4),
.large-table td:nth-child(5),
.large-table th:nth-child(3),
.large-table th:nth-child(4),
.large-table th:nth-child(5) {
    text-align: center;
}

.large-table td:nth-child(2),
.large-table th:nth-child(2) {
    text-align: left;
}

/* ===========================
   Pagination
=========================== */
.pagination {
    display: flex;
    justify-content: flex-start;
    gap: 5px;
    margin: 15px 0;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid #007BFF;
    background-color: #fff;
    color: #007BFF;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    background-color: #007BFF;
    color: #fff;
}

.pagination button:disabled {
    background-color: #007BFF;
    color: #fff;
    cursor: default;
}

.table-wrapper .pagination {
    text-align: center;
    margin-top: 15px;
}

.table-wrapper .pagination button {
    margin: 2px;
    padding: 6px 12px;
    border: 1px solid #007BFF;
    background-color: #fff;
    color: #007BFF;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 600;
    transition: 0.2s;
}

.table-wrapper .pagination button:hover {
    background-color: #007BFF;
    color: #fff;
}

.table-wrapper .pagination button:disabled {
    background-color: #007BFF;
    color: #fff;
    cursor: default;
}

/* ===========================
   Charts & Donut Wrappers
=========================== */
.donut-wrapper {
    max-width: 450px;
    margin: 0 auto;
    padding: 10px;
    position: relative;
}

.donut-wrapper .chart-legend-right {
    margin-top: 15px;
    padding: 10px 15px;
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.donut-wrapperA {
    height: 250px;
    max-width: 550px;
    margin: 0 auto;
    padding: 5px;
}

.donut-wrapperB {
    height: 500px;
    max-width: 550px;
    margin: 0 auto;
    padding: 5px;
}

#academicChart {
    width: 100% !important;
    height: auto !important;
}

.pie-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.pie-chart-wrapper {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: nowrap;
    margin-bottom: 30px;
}

.pie-box {
    flex: 1 1 45%;
    height: 400px;
}

.pie-box canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Publication Year Bar Chart */
#pubYearChart {
    width: 100%;
    max-width: 900px;
    height: 400px;
    margin: 0 auto 20px;
    display: block;
}

@media (max-width: 576px) {
    #pubYearChart {
        height: 300px;
    }
}

/* Chart Row Layout */
.chart-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===========================
   Teaching Container Layouts
=========================== */
.teach-container {
    max-width: 1400px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.teach-container2 {
    max-width: 1400px;
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin: 0 auto;
}

.left-box {
    flex: 2;
}

.right-box {
    flex: 1;
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.chart-box canvas {
    width: 100% !important;
    height: auto !important;
}

@media (max-width: 768px) {
    .teach-container {
        flex-direction: column;
    }
}

/* ===========================
   Title Head
=========================== */
.titleHead {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

/* ===========================
   Header Image
=========================== */
.header-img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===========================
   Language Selector
=========================== */
.lang-selector { 
    position: absolute; 
    top: 10px; 
    right: 20px; 
    z-index: 100; 
}
.lang-selector select { 
    min-width: 140px; 
    background: rgba(255,255,255,0.9); 
}

/* ===========================
   Tab Loading & Error States
=========================== */
.tab-loading { 
    text-align: center; 
    padding: 40px; 
    color: #666; 
}
.tab-error { 
    text-align: center; 
    padding: 20px; 
    color: #c33; 
    background: #fee; 
    border-radius: 8px; 
    margin: 10px; 
}

/* ===========================
   Autocomplete Styles
=========================== */
.autocomplete-wrapper { 
    position: relative; 
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    color: #6c757d;
    font-size: 1rem;
    pointer-events: none;
    transition: color 0.2s;
}

.search-input-wrapper input {
    padding-left: 38px;
    padding-right: 12px;
}

.search-input-wrapper input:focus + .search-icon {
    color: #082E72;
}

.search-input-wrapper .loading-spinner {
    position: absolute;
    right: 12px;
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #082E72;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.search-input-wrapper.loading .loading-spinner { 
    display: block; 
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 350px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.autocomplete-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.autocomplete-header {
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-size: 0.75rem;
    color: #666;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.15s ease;
}

.autocomplete-item:hover, 
.autocomplete-item.active {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    padding-left: 16px;
}

.autocomplete-item:last-child { 
    border-bottom: none; 
}

.autocomplete-item .name {
    font-weight: 600;
    color: #082E72;
    font-size: 0.9rem;
}

.autocomplete-item .name mark {
    background: linear-gradient(120deg, #fff176 0%, #ffeb3b 100%);
    padding: 1px 4px;
    border-radius: 3px;
}

.autocomplete-item .info {
    font-size: 0.8rem;
    color: #555;
    margin-top: 3px;
}

.autocomplete-item .info mark {
    background: linear-gradient(120deg, #fff176 0%, #ffeb3b 100%);
    padding: 1px 4px;
    border-radius: 3px;
}

.autocomplete-item .faculty { 
    margin-top: 5px; 
}

/* ===========================
   Faculty Badges
=========================== */
.faculty-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.faculty-badge.fkaiks { background: #e3f2fd; color: #1565c0; }
.faculty-badge.ftmk { background: #f3e5f5; color: #7b1fa2; }
.faculty-badge.fkp { background: #e8f5e9; color: #2e7d32; }
.faculty-badge.fkekk { background: #fff3e0; color: #e65100; }
.faculty-badge.ftkip { background: #fce4ec; color: #c2185b; }
.faculty-badge.ftk { background: #e0f7fa; color: #00838f; }
.faculty-badge.fptt { background: #f1f8e9; color: #558b2f; }
.faculty-badge.default { background: #f5f5f5; color: #616161; }

/* ===========================
   Autocomplete States
=========================== */
.autocomplete-loading, 
.autocomplete-empty {
    padding: 15px;
    text-align: center;
    color: #888;
}

.autocomplete-empty i { 
    font-size: 1.2rem; 
    margin-bottom: 5px; 
    display: block; 
}

/* ===========================
   Search Section
=========================== */
.search-section {
    background: #E7EFFF;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

/* ===========================
   Accessibility - Focus Visible
=========================== */
.autocomplete-item:focus-visible {
    outline: 2px solid #082E72;
    outline-offset: -2px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
}

#searchName:focus-visible {
    outline: 2px solid #082E72;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(8, 46, 114, 0.15);
}

/* ===========================
   Mobile Responsive - Autocomplete
=========================== */
@media (max-width: 576px) {
    .autocomplete-dropdown { 
        max-height: 50vh; 
    }
    .autocomplete-item { 
        padding: 14px 12px; 
        min-height: 48px; /* Touch-friendly */
    }
    #searchName { 
        font-size: 16px; /* Prevent iOS zoom */
    }
}
