/* ============================================
   ORGANIZATION CHART - BLUE PURPLE THEME
   WITH POP-UP EFFECTS
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f0f2f8;
    padding: 40px 20px;
    min-height: 100vh;
}

.chart-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.04);
    animation: fadeInPage 0.8s ease-out;
}

/* ============================================
   PAGE FADE IN ANIMATION
   ============================================ */
@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============================================
   POP IN ANIMATIONS
   ============================================ */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.7) translateY(30px);
    }
    70% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes popInLeft {
    0% {
        opacity: 0;
        transform: translateX(-40px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes popInRight {
    0% {
        opacity: 0;
        transform: translateX(40px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes popInUp {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   BACK BUTTON
   ============================================ */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
    padding: 8px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(99, 102, 241, 0.1);
    margin-bottom: 30px;
    animation: popInLeft 0.7s ease-out 0.1s both;
}

.btn-back:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #ffffff;
    transform: translateX(-5px) scale(1.03);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.35);
}

/* ============================================
   HEADER
   ============================================ */
.chart-header {
    text-align: center;
    margin-bottom: 40px;
    animation: popIn 0.8s ease-out 0.2s both;
}

.chart-header h2 {
    color: #1e1b4b;
    font-weight: 800;
    font-size: 36px;
}

.chart-header h2 i {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 12px;
}

.chart-header p {
    color: rgba(0, 0, 0, 0.4);
    font-size: 16px;
    margin-top: 5px;
}

/* ============================================
   CHART CONTAINER
   ============================================ */
.chart-container {
    position: relative;
    padding: 20px 0;
}

/* ============================================
   CHART LEVELS
   ============================================ */
.chart-level {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 10px;
}

.top-level {
    margin-bottom: 5px;
}

.top-level .chart-card {
    min-width: 320px;
    max-width: 450px;
}

/* ============================================
   CHART CARDS
   ============================================ */
.chart-card {
    background: rgba(99, 102, 241, 0.03);
    border-radius: 16px;
    padding: 25px 20px;
    text-align: center;
    border: 2px solid rgba(99, 102, 241, 0.08);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Individual Card Animations */
.president { 
    animation: popIn 0.8s ease-out 0.3s both; 
}

.vice-president:nth-child(1) { 
    animation: popInRight 0.8s ease-out 0.4s both; 
}

.vice-president:nth-child(2) { 
    animation: popInLeft 0.8s ease-out 0.5s both; 
}

.secretary:nth-child(1) { 
    animation: popInUp 0.6s ease-out 0.5s both; 
}

.secretary:nth-child(2) { 
    animation: popInUp 0.6s ease-out 0.6s both; 
}

.treasurer:nth-child(1) { 
    animation: popInUp 0.6s ease-out 0.7s both; 
}

.treasurer:nth-child(2) { 
    animation: popInUp 0.6s ease-out 0.8s both; 
}

.exco:nth-child(1) { 
    animation: popInUp 0.6s ease-out 0.9s both; 
}

.exco:nth-child(2) { 
    animation: popInUp 0.6s ease-out 1.0s both; 
}

.chart-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.12);
}

/* Card Colors */
.president { 
    border-color: #6366f1; 
    background: rgba(99, 102, 241, 0.08); 
}

.vice-president { 
    border-color: #8b5cf6; 
    background: rgba(139, 92, 246, 0.06); 
}

.secretary { 
    border-color: #3b82f6; 
    background: rgba(59, 130, 246, 0.06); 
}

.treasurer { 
    border-color: #2ed573; 
    background: rgba(46, 213, 115, 0.06); 
}

.exco { 
    border-color: #fbbf24; 
    background: rgba(251, 191, 36, 0.06); 
}

.chart-card .chart-icon {
    width: 55px;
    height: 55px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #ffffff;
    transition: all 0.5s ease;
    flex-shrink: 0;
}

.president .chart-icon { 
    background: linear-gradient(135deg, #6366f1, #8b5cf6); 
}

.vice-president .chart-icon { 
    background: linear-gradient(135deg, #8b5cf6, #a78bfa); 
}

.secretary .chart-icon { 
    background: linear-gradient(135deg, #3b82f6, #60a5fa); 
}

.treasurer .chart-icon { 
    background: linear-gradient(135deg, #2ed573, #7bed9f); 
}

.exco .chart-icon { 
    background: linear-gradient(135deg, #fbbf24, #f59e0b); 
}

.chart-card:hover .chart-icon {
    transform: scale(1.15) rotate(-10deg);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.25);
}

.chart-card h4 {
    color: #1e1b4b;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 2px;
}

/* ============================================
   FULL NAME - FIX FOR LONG NAMES
   ============================================ */
.full-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e1b4b;
    word-wrap: break-word;
    line-height: 1.5;
    margin-bottom: 8px;
    padding: 0 5px;
    max-width: 100%;
}

/* Extra fix for very long names */
.vice-president .full-name {
    font-size: 11px;
}

.secretary .full-name {
    font-size: 11px;
}

.treasurer .full-name {
    font-size: 11px;
}

.exco .full-name {
    font-size: 11px;
}

.badge-role {
    display: inline-block;
    padding: 4px 16px;
    border-radius: 50px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    margin-top: auto;
}

/* ============================================
   CONNECTOR LINES
   ============================================ */
.chart-connector {
    display: flex;
    justify-content: center;
    padding: 5px 0 15px;
}

.connector-line {
    width: 2px;
    height: 40px;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.05));
    position: relative;
}

.connector-line::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6366f1;
    opacity: 0.3;
}

/* ============================================
   SUB CLUBS
   ============================================ */
.clubs-level {
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    width: 100%;
}

.clubs-title {
    text-align: center;
    color: #1e1b4b;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 20px;
    animation: popIn 0.6s ease-out 1.1s both;
}

.clubs-title i {
    color: #6366f1;
    margin-right: 8px;
}

.sub-clubs-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
    margin: 10px auto 0;
    max-width: 700px;
}

.club-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 30px;
    background: rgba(99, 102, 241, 0.04);
    border-radius: 14px;
    border: 2px solid rgba(99, 102, 241, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
    opacity: 0;
    animation: popInUp 0.6s ease-out forwards;
    flex: 0 1 auto;
    min-width: 120px;
    text-align: center;
}

.club-badge:nth-child(1) { animation-delay: 1.2s; }
.club-badge:nth-child(2) { animation-delay: 1.3s; }
.club-badge:nth-child(3) { animation-delay: 1.4s; }
.club-badge:nth-child(4) { animation-delay: 1.5s; }

.club-badge:hover {
    transform: translateY(-8px) scale(1.05);
    background: rgba(99, 102, 241, 0.08);
    border-color: #6366f1;
    box-shadow: 0 10px 35px rgba(99, 102, 241, 0.12);
}

.club-badge i {
    font-size: 32px;
    color: #6366f1;
    margin-bottom: 8px;
    transition: all 0.4s ease;
}

.club-badge:hover i {
    color: #8b5cf6;
    transform: scale(1.1) rotate(-5deg);
}

.club-badge span {
    font-size: 13px;
    font-weight: 600;
    color: #1e1b4b;
    text-align: center;
    letter-spacing: 0.3px;
}

/* ============================================
   LEGEND
   ============================================ */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 35px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    animation: popIn 0.6s ease-out 1.6s both;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.6);
    font-weight: 500;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.president-color { background: #6366f1; }
.vice-color { background: #8b5cf6; }
.secretary-color { background: #3b82f6; }
.treasurer-color { background: #2ed573; }
.exco-color { background: #fbbf24; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .chart-wrapper { 
        padding: 30px; 
    }
    .chart-header h2 { 
        font-size: 30px; 
    }
    .chart-card { 
        min-height: 160px; 
        padding: 20px 15px; 
    }
    .full-name { 
        font-size: 11px; 
    }
    .vice-president .full-name {
        font-size: 10px;
    }
    .top-level .chart-card {
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .chart-wrapper { 
        padding: 20px; 
        border-radius: 16px; 
    }
    .chart-header h2 { 
        font-size: 24px; 
    }
    .chart-header p { 
        font-size: 14px; 
    }
    .chart-card { 
        min-height: 140px; 
        padding: 15px 12px; 
    }
    .chart-card h4 { 
        font-size: 14px; 
    }
    .full-name { 
        font-size: 10px; 
    }
    .vice-president .full-name {
        font-size: 9px;
    }
    .badge-role { 
        font-size: 9px; 
        padding: 3px 12px; 
    }
    .chart-icon { 
        width: 45px; 
        height: 45px; 
        font-size: 20px; 
    }
    .connector-line { 
        height: 25px; 
    }
    .clubs-title { 
        font-size: 16px; 
    }
    .sub-clubs-grid {
        gap: 15px;
        max-width: 100%;
    }
    .club-badge {
        padding: 15px 20px;
        min-width: 80px;
        flex: 1 1 40%;
        max-width: 45%;
    }
    .club-badge i {
        font-size: 26px;
    }
    .club-badge span {
        font-size: 11px;
    }
    .chart-legend { 
        gap: 12px; 
    }
    .legend-item { 
        font-size: 12px; 
    }
    .top-level .chart-card {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .chart-wrapper { 
        padding: 15px; 
    }
    .chart-header h2 { 
        font-size: 20px; 
    }
    .chart-card { 
        min-height: 120px; 
        padding: 12px 10px; 
    }
    .chart-card h4 { 
        font-size: 12px; 
    }
    .full-name { 
        font-size: 9px; 
    }
    .vice-president .full-name {
        font-size: 8px;
    }
    .badge-role { 
        font-size: 8px; 
        padding: 2px 10px; 
    }
    .chart-icon { 
        width: 40px; 
        height: 40px; 
        font-size: 18px; 
        margin-bottom: 8px;
    }
    .btn-back { 
        font-size: 12px; 
        padding: 6px 16px; 
    }
    .connector-line { 
        height: 15px; 
    }
    .sub-clubs-grid {
        gap: 10px;
    }
    .club-badge {
        padding: 12px 15px;
        min-width: 70px;
        flex: 1 1 45%;
        max-width: 48%;
    }
    .club-badge i {
        font-size: 22px;
        margin-bottom: 5px;
    }
    .club-badge span {
        font-size: 10px;
    }
    .chart-legend {
        gap: 8px;
    }
    .legend-item {
        font-size: 10px;
    }
    .legend-color {
        width: 12px;
        height: 12px;
    }
}