/* Base styles */
* {
    font-family: 'Exo 2', Sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    color: #a8a8a8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
  background-color: #000000;
  padding: 16px 40px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Purple Glow Across Top */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(147, 112, 219, 0.1) 20%, 
        rgba(147, 112, 219, 0.3) 40%,
        rgba(147, 112, 219, 0.5) 50%,
        rgba(147, 112, 219, 0.3) 60%,
        rgba(147, 112, 219, 0.1) 80%,
        transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
}

.logo-section {
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    align-items: center;
    position: relative;
    transition: all 0.4s ease;
    overflow: hidden;
    box-shadow: 0 0 0 rgba(98, 77, 227, 0); /* Start with transparent shadow */
}

.logo-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(207, 183, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    transition: none;
}

.logo-section:hover {
    box-shadow: 0 4px 8px rgba(98, 77, 227, 0.15);
}

.logo-section:hover::before {
    animation: shimmer 1.2s ease-in-out;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 150%;
    }
}

.logo {
    height: 28px;
    transition: all 0.2s;
    margin-top: 3px;
    margin-right: 4px;
}

.nav-links {
  display: flex;
  gap: 40px;
}

.nav-link {
    font-weight: 400;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #a8a8a8;
    padding: 5px 0;
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: #9370db;
    visibility: hidden;
    transition: all 0.3s;
}

.nav-link:hover {
    color: #fff;
}

.nav-link:hover::before {
    visibility: visible;
    width: 100%;
}

/* Main container */
main {
    padding: 30px;
    display: flex;
    justify-content: center;
}

.content-container {
    width: 100%;
    position: relative;
}

/* University Header - MIT */
.university-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    background-color: #222;
    border-radius: 12px 12px 0 0;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border-left: 5px solid var(--school-color);
}

.university-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='10' y='15' font-family='Arial' font-size='12' fill='%23A31F34' fill-opacity='0.05'%3EMIT MIT MIT%3C/text%3E%3C/svg%3E");
    background-size: 100px;
    opacity: 0.5;
    z-index: 0;
}

.university-info {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.university-logo {
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: white;
    border-radius: 50%;
    box-shadow: 0 4px 10px color-mix(in srgb, var(--school-color) 40%, transparent);
    position: relative;
    overflow: hidden;
}

.university-logo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent);
}

.university-info h2 {
    color: white;
    font-size: 22px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.university-details {
    display: flex;
    flex-direction: column;
}

.university-name {
    font-weight: 600; /* Increase font weight */
    color: white;
    white-space: nowrap;
    display: flex;
    align-items: center; /* Center align items vertically */
    gap: 8px; /* Add gap between name and badge */
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 26px; /* Increase font size slightly */
}

.rank-badge {
    height: 40px; /* Consistent height */
    width: 40px; /* Consistent width */
    margin-top: 5px;
    display: inline-block;
    vertical-align: middle;
}

.university-stats {
    margin-top: -5px;
    display: flex;
    font-size: 12px;
    color: #888;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-icon {
    height: 10px;
    width: 10px;
    opacity: 0.6;
    margin-top: 3px;
}

.view-stats-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background-color: color-mix(in srgb, var(--school-color) 10%, transparent);
    border: 2px solid var(--school-color);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.view-stats-button:hover {
    color: white;
    transform: translateY(-2px);
    background-color: color-mix(in srgb, var(--school-color) 40%, transparent);
}


/* Members Table */
.members-table {
    background-color: #222;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-top: none;
    position: relative;
}

/* Table Header */
.table-header {
    display: grid;
    grid-template-columns: 80px 1fr 180px 150px;
    padding: 18px 25px;
    background-color: #1a1a1a;
    color: #8A8B8C;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #333;
    position: relative;
}

.table-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--school-color), transparent);
}

.column-rank, .column-username {
    text-align: left;
}

.column-rating, .column-change {
    text-align: right;
}

/* Members List */
.members-list {
    list-style: none;
    position: relative;
}

.user-row-clickable {
    text-decoration: none;
    color: inherit;
}

.member-item {
    display: grid;
    grid-template-columns: 80px 1fr 180px 150px;
    align-items: center;
    padding: 18px 25px;
    border-bottom: 1px solid #333;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.member-item:hover {
    background-color: color-mix(in srgb, var(--school-color) 15%, transparent);
    transform: translateX(5px);
}

.member-item:hover::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background-color: var(--school-color);
}

/* Rank Styling */
.rank-container {
    position: relative;
}

.rank-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    background-color: #333;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.rank-number::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent);
}

.gold {
    background: linear-gradient(135deg, #F5D14B, #EABC0F, #D9A420);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.silver {
    background: linear-gradient(135deg, #E8E8E8, #C0C0C0, #A8A8A8);
    box-shadow: 0 0 8px rgba(192, 192, 192, 0.4);
    border: 1px solid rgba(192, 192, 192, 0.3);
}

.bronze {
    background: linear-gradient(135deg, #E0A684, #CD7F32, #A46628);
    box-shadow: 0 0 8px rgba(205, 127, 50, 0.4);
    border: 1px solid rgba(205, 127, 50, 0.3);
}

.member-item:hover .rank-number {
    transform: scale(1.05);
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background-color: #333;
    border: 2px solid #3a3a3a;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.member-item:hover .user-avatar {
    border-color: var(--school-color);
    transform: scale(1.05);
}

.username {
    font-weight: 500;
    color: white;
    transition: all 0.3s;
}

.member-item:hover .username {
    color: var(--school-color);
    font-weight: 600;
}

/* Rating */
.rating {
    text-align: right;
    font-weight: 600;
    color: white;
    transition: all 0.2s;
    position: relative;
}

.member-item:hover .rating {
    transform: scale(1.05);
}

/* Rating Change */
.rating-change {
    text-align: right;
    font-weight: 600;
    position: relative;
    color: #a8a8a8;
    transition: all 0.2s;
}

.rating-change.positive {
    color: #2dc932;
}

.rating-change.negative {
    color: #e53935;
}

.member-item:hover .rating-change {
    transform: scale(1.05);
}

/* MIT Pattern Divider */
.mit-pattern-divider {
    height: 15px;
    margin: 30px 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='15' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='33.33' height='15' x='0' fill='%23A31F34' fill-opacity='0.7'/%3E%3Crect width='33.33' height='15' x='33.33' fill='%23A31F34' fill-opacity='0.5'/%3E%3Crect width='33.33' height='15' x='66.66' fill='%23A31F34' fill-opacity='0.3'/%3E%3C/svg%3E");
    background-size: 100px 15px;
    border-radius: 2px;
    opacity: 0.8;
}

@media (max-width: 1024px) {
    .university-name {
        font-size: 24px;
    }
}

/* Media Query for Tablet Devices (768px) */
@media screen and (max-width: 768px) {
  /* Header adjustments */
  header {
    padding: 12px 20px;
  }
  
  .header-wrap {
    max-width: 740px;
    margin: 0 auto;
  }
  
  .nav-links {
    gap: 20px;
  }
  
  .logo {
    height: 24px;
  }
  
  .content-container {
    max-width: 740px;
    margin: 0 auto;
  }
  
  /* University header adjustments - scaled down version of original */
  .university-header {
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .university-info {
    display: flex;
    align-items: center;
    gap: 15px;
  }
  
  .university-logo {
    width: 50px;
    height: 50px;
  }
  
  .university-name {
    font-size: 18px;
  }
  
  .rank-badge {
    height: 28px;
    width: 28px;
  }
  
  .university-stats {
    font-size: 11px;
  }
  
  .view-stats-button {
    padding: 8px 14px;
    font-size: 12px;
  }
  
  /* Table adjustments - scaled down version of original */
  .table-header {
    grid-template-columns: 60px 1fr 100px 80px;
    padding: 14px 18px;
    font-size: 11px;
  }
  
  .member-item {
    grid-template-columns: 60px 1fr 100px 80px;
    padding: 14px 18px;
  }
  
  .rank-number {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
  }
  
  .user-info {
    gap: 10px;
  }
  
  .username {
    font-size: 14px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .rating {
    font-size: 14px;
  }
  
  .rating-change {
    font-size: 13px;
  }
}

/* Mobile Media Query for Students Page */
@media (max-width: 425px) {
    /* Center the logo and navigation */
    .header-wrap {
        flex-direction: column;
        align-items: center;
        padding: 15px 0;
    }
    
    /* Add some space between logo and navigation */
    .logo-section {
        margin-bottom: 15px;
    }
    
    /* Center the navigation links */
    .nav-links {
        justify-content: center;
    }
    
    /* University header adjustments */
    .university-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
        gap: 15px;
    }
    
    .university-logo {
        width: 40px;
        height: 40px;
    }
    
    .university-name {
        font-size: 18px;
        max-width: 250px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }
    
    .rank-badge {
        height: 24px;
        width: 24px;
    }
    
    /* Hide student stats completely */
    .university-stats {
        display: none;
    }
    
    .view-stats-button {
        align-self: stretch;
        text-align: center;
        justify-content: center;
        padding: 10px;
        font-size: 12px;
        margin-top: 5px;
    }
    
    /* Table structure adjustments */
    .table-header, 
    .member-item {
        grid-template-columns: 50px 1fr 100px;
        padding: 14px 10px;
    }
    
    /* Hide the Rating Δ column completely */
    .column-change,
    .member-item > *:nth-child(4),
    .rating-change {
        display: none;
    }
    
    /* Adjust rank size */
    .rank-number {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    /* User info adjustments */
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    
    .user-info {
        gap: 8px;
    }
    
    .username {
        font-size: 13px;
        max-width: 130px;
    }
    
    /* Change the column header text */
    .column-rating::before {
        content: "RATING";
        text-align: right;
        display: block;
    }
    
    /* Hide the original "CONTEST RATING" text */
    .column-rating {
        font-size: 0;
        text-align: right;
    }
    
    .column-rating::before {
        font-size: 11px;
    }
    
    /* Make sure rating values are right-aligned */
    .rating {
        font-size: 13px;
        text-align: right;
    }
    
    /* Pattern divider adjustment */
    .pattern-divider {
        margin: 20px 0;
    }
}

@media (max-width: 375px) {
    .university-name {
        max-width: 210px;
    }
}