:root {
    --color-primary-container: #ffffff;
    --color-on-container: #333333;
    --color-primary: hsla(208, 59%, 45%, 1);
    --color-primary-300: #5d9dd5;
    --color-secondary: hsla(12, 83%, 62%, 1);
    --color-tertiary: hsla(200, 67%, 61%, 1);
    --color-tertiary-100: hsla(200, 67%, 95%, 1);
    --color-quaternary: rgb(223, 86, 52);
    --color-positive-container: #a5d46a;
    --color-positive-on-container: #84a954;
    --color-positive-text-on-container: #2d4a1a;
    --color-positive: #526a35;
    --color-negative-container: #ffa080;
    --color-negative-on-container: #cc8066;
    --color-negative-text--on-container: #5c2e1f;
    --color-negative: #7f5040;
    --color-warning-container: #ffdf80;
    --color-warning-on-container: #ff9c1a;
    --color-warning-text--on-container: #8b4513;
    --color-warning: #926b15;
    --color-monk: #00ffba;
    --color-druid: #ff7c0a;
    --color-warrior: #c69b6d;
    --color-paladin: #f48cba;
    --color-hunter: #aad372;
    --color-rogue: #fff468;
    --color-priest: #f0ebe0;
    --color-death-knight: #c41e3b;
    --color-shaman: #2359ff;
    --color-mage: #68ccef;
    --color-warlock: #9382c9;
    --color-demon-hunter: #a330c9;
    --color-evoker: #33937f;
    --color-normal: #0070dd;
    --color-heroic: #a335ee;
    --color-mythic: #ff8000;
    --color-absence: #802e2e;
    --color-background-100: #3a465f;
    --color-background-300: #323a48;
    --color-background-500: #232a39;
    --color-background-700: #151c28;
    --color-background-800: #0a0d15;
    --shadow-cards: 0 0 13px 0 rgba(0,0,0,.15);
}

@font-face {
    font-family: 'Poppins';
    src: url('../fonts/Poppins-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Poppins';
    src: url('../fonts/Poppins-SemiBold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    scrollbar-color: var(--color-primary) var(--color-tertiary);
    scrollbar-width: thin;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--color-primary-container);
    color: var(--color-on-container);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-primary);
}

h2 {
    margin-top: 2rem;
}

a {
    text-decoration: underline;
    color: var(--color-secondary);
    box-shadow: inset 0 0 0 0 var(--color-secondary);
    margin: 0 -.25rem;
    padding: 0 .25rem;
    transition: color .3s ease-in-out, box-shadow .3s ease-in-out;
}

a:hover {
    box-shadow: inset 300px 0 0 0 var(--color-secondary);
    color: white;
    text-decoration: none;
}

p {
    margin-top: 0.5rem;
}

li::marker {
    content: '▹ ';
    color: var(--color-secondary);
}

header {
    text-align: center;
    height: 100vh;
    /* Use dynamic viewport height for mobile Safari */
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

header.collapsed {
    height: auto;
    min-height: auto;
}

header.collapsed .hero {
    height: auto;
    padding: 1rem;
    justify-content: flex-start;
}

header.collapsed .hero h1 img {
    max-height: 8rem;
}

.align-right {
    text-align: right !important;
}

.hero {
    background-image: url('../images/hero.jpg'), radial-gradient(circle, var(--color-tertiary) 0%, var(--color-primary) 100%);
    background-size: cover, 120%;
    background-position: center, top left;
    padding: 4rem 1rem;
    color: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.hero h1 {
    margin-bottom: 1rem;
}

.hero h1 img {
    max-width: 100%;
    height: auto;
    max-height: 30rem;
    object-fit: contain;
    filter: drop-shadow(0px 0px 16px rgba(0, 0, 0, 0.5));
}

nav {
    position: relative;
    z-index: 1000;
    display: flex;
    justify-content: center;
    background-color: var(--color-primary);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.6);
    /* Add safe area support for mobile devices */
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-container {
    position: relative;
    display: inline-block;
    text-align: center;
    padding: 0.5rem;
}

.nav-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    height: 100%;
    background: linear-gradient(to bottom, var(--color-tertiary), var(--color-primary));
    clip-path: polygon(0 0, 100% 0, 90% 100%, 10% 100%);
    z-index: -1;
    opacity: 1;
}

nav ul {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0.5rem;
}

nav ul li {
    margin: 0;
    padding: 0 1rem;
    border-width: 0 1px 0 0;
    border-style: solid;
    border-image: linear-gradient(to bottom, var(--color-tertiary), white, var(--color-tertiary)) 1 100%;
}

nav ul li::marker {
    content: none;
}

nav ul li:last-child {
    border-right: none;
}

nav ul li a {
    color: var(--color-primary-container);
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0.5rem 1rem;
    box-shadow: none;
    transition: none;
    /* Improve touch targets for mobile */
    min-height: 44px;
    min-width: 44px;
}

nav ul li a:visited, nav ul li a:focus {
    color: var(--color-primary-container);
}

nav ul li a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--color-primary);
    border-radius: 3px;
    transform: translate(-50%, -50%);
    z-index: -1;
    transition: width 0.3s ease, height 0.3s ease;
}

nav ul li a.active::before {
    width: 110%;
    height: 150%;
    background: var(--color-primary);
    opacity: 0.8;
}

nav ul li a:hover::before {
    width: 110%;
    height: 150%;
}

nav ul li a:hover,
nav ul li a:focus {
    color: var(--color-primary-container);
    outline: none;
    box-shadow: none;
}

/* Add padding to main when header is collapsed to prevent content overlap */
body.header-collapsed main {
    padding-top: 120px; /* Approximate height of collapsed header */
}

main {
    background-color: var(--color-primary-container);
    flex: 1;
    transition: padding-top 0.5s ease;
}

/* Section layout styles */
.section-full-width .content-container {
    max-width: 70rem;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-with-aside .content-container {
    display: flex;
    gap: 2rem;
    max-width: 70rem;
    margin: 0 auto;
    padding: 0 2rem;
}

.content-container > p {
    color: var(--color-on-container);
}

.section-with-aside .main-content {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

section > * {
    width: 100%;
    max-width: 60rem;
}

.section-full-width > * {
    width: 100%;
    max-width: 70rem;
}

.raid-info {
    width: 300px;
    flex-shrink: 0;
    margin-top: 5rem;
    height: fit-content;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.raid-progress {
    background: linear-gradient(color-mix(in srgb, var(--color-background-500), transparent 100%), color-mix(in srgb, var(--color-background-300), transparent 60%)), url('../images/raid-progress.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    box-shadow: var(--shadow-cards);
    max-width: 400px;
    flex: 1 1 280px;
    min-width: 280px;
}

.raid-progress.manaforge-omega {
    border: 2px solid var(--color-primary-300);
}

.raid-progress.liberation-of-undermine {
    background: linear-gradient(color-mix(in srgb, var(--color-background-100), transparent 20%), color-mix(in srgb, var(--color-background-300), transparent 10%)), url('../images/raid-progress-undermine.jpg');
}

.raid-progress.nerubar-palace {
    background: linear-gradient(color-mix(in srgb, var(--color-background-100), transparent 20%), color-mix(in srgb, var(--color-background-300), transparent 10%)), url('../images/raid-progress-nerubar.jpg');
}

.raid-progress h3 {
    color: var(--color-secondary);
    text-shadow: #000000 0 0 10px;
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: bold;
}

.difficulty {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    color: var(--color-tertiary);
    font-size: 0.9rem;
}

.difficulty-name {
    font-weight: bold;
    text-shadow: #000000 0 0 10px;
}

.progress {
    color: var(--color-secondary);
    font-weight: bold;
    text-shadow: #000000 0 0 10px;
}

.arrow-right {
  border: solid var(--color-secondary);
  border-width: 0 3px 3px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(-45deg);
}

td.character {
    word-break: keep-all;
}

.character-icon {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    position: relative;
    margin-right: 8px;
    vertical-align: middle;
}

.character-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../icons/classes/border.png');
    background-size: cover;
    background-position: center;
    pointer-events: none;
}

.role-icon {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    position: relative;
    margin-right: 8px;
    vertical-align: middle;
}

.role-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../icons/roles/border.png');
    background-size: cover;
    background-position: center;
    pointer-events: none;
}

.healer .role-icon {
    background-image: url('../icons/roles/healer.png');
}

.tank .role-icon {
    background-image: url('../icons/roles/tank.png');
}

.damage .role-icon {
    background-image: url('../icons/roles/dps.png');
}

.monk {
    color: var(--color-monk);
}

.monk .character-icon {
    background-image: url('../icons/classes/monk.jpg');
}

.druid .character-icon {
    background-image: url('../icons/classes/druid.jpg');
}

.druid {
    color: var(--color-druid);
}

.hunter {
    color: var(--color-hunter);
}

.hunter .character-icon {
    background-image: url('../icons/classes/hunter.jpg');
}

.warrior {
    color: var(--color-warrior);
}

.warrior .character-icon {
    background-image: url('../icons/classes/warrior.jpg');
}    

.mage {
    color: var(--color-mage);
}

.mage .character-icon {
    background-image: url('../icons/classes/mage.jpg');
}    

.priest {
    color: var(--color-priest);
}    

.priest .character-icon {
    background-image: url('../icons/classes/priest.jpg');
}        

.evoker {
    color: var(--color-evoker);
}        

.evoker .character-icon {
    background-image: url('../icons/classes/evoker.png');
}        

.death-knight .character-icon {
    background-image: url('../icons/classes/death-knight.jpg');
}        

.warlock {
    color: var(--color-warlock);
}

.warlock .character-icon {
    background-image: url('../icons/classes/warlock.jpg');
}        

.paladin {
    color: var(--color-paladin);
}        

.paladin .character-icon {
    background-image: url('../icons/classes/paladin.jpg');
}        

.rogue {
    color: var(--color-rogue);
}        

.rogue .character-icon {
    background-image: url('../icons/classes/rogue.jpg');
}        

.shaman {
    color: var(--color-shaman);
}    

.shaman .character-icon {
    background-image: url('../icons/classes/shaman.jpg');
}    

.death-knight {
    color: var(--color-death-knight);
}    

.demon-hunter {
    color: var(--color-demon-hunter);
}

.demon-hunter .character-icon {
    background-image: url('../icons/classes/demon-hunter.jpg');
}

.difficulty-normal {
    color: var(--color-normal);
}

.difficulty-heroic {
    color: var(--color-heroic);
}

.difficulty-mythic {
    color: var(--color-mythic);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-cards);
    color: var(--color-tertiary);
}

thead tr {
    border-bottom: 1px solid var(--color-background-300);
}

tr {
    height: 2.5rem;
}

th, td {
    position: relative;
    padding: 0.5rem 1rem;
    text-align: left;
}

tbody tr:nth-child(odd) {
    background-color: var(--color-background-500);
}

tbody tr:nth-child(even) {
    background-color: var(--color-background-300);
}

tbody tr:hover {
    background-color: var(--color-background-100);
    cursor: pointer;
}

footer {
    text-align: center;
    margin-top: auto;
    padding: 1rem;
    /* Add safe area padding for footer */
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

/* User info and dropdown in header */
.user-dropdown {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    color: white;
    cursor: pointer;
    padding: 0.5rem 1rem;
    min-height: 44px;
    max-width: 250px; /* Prevent extremely long usernames from breaking layout */
}

.user-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0; /* Allow text to shrink */
}

.user-info small {
    font-size: 0.7em;
    margin-left: 0.3rem;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.user-dropdown.active .user-info small {
    transform: rotate(180deg);
}

.user-info .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--color-primary);
    min-width: 160px;
    width: max-content;
    max-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    border-radius: 0 0 4px 4px;
    z-index: 1001; /* Higher than nav's z-index of 1000 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    display: none !important; /* Force hide with !important */
}

.user-dropdown:hover .dropdown-content,
.user-dropdown.active .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block !important; /* Show the dropdown when active, override the !important hide */
}

.dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    transition: background-color 0.3s ease;
}

.dropdown-content a:hover {
    background-color: var(--color-tertiary);
    box-shadow: none;
}

.dropdown-content a:hover::before {
    content: none;
    width: 0;
    height: 0;
}

/* Header overflow fix for dropdown */
header.no-overflow {
    overflow: visible !important;
}

/* Responsive Design */
@media (min-width: 768px) {
    nav ul li {
        padding: 0 1.5rem;
    }
}

@media (max-width: 1200px) {
    .section-with-aside .content-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .raid-info {
        width: 100%;
        position: static;
        margin-top: 0;
        justify-content: center;
    }
    
    .raid-progress {
        flex: 1 1 200px;
        min-width: 200px;
    }

    .difficulty {
        display: block;
    }
}

@media (max-width: 767px) {
    a:hover {
        box-shadow: none;
    }
    
    .hero h1 img {
        max-width: 80%;
    }

    .nav-container::before {
        content: none;
    }

    nav {
        background: linear-gradient(to bottom, var(--color-tertiary), var(--color-primary));
    }

    nav ul {
        flex-wrap: wrap;
        padding: 0;
    }

    nav ul li {
        padding: 0.25rem 0.5rem;
    }
    
    body.header-collapsed main {
        padding-top: 100px; /* Smaller padding for mobile */
    }

    .section-full-width .content-container,
    .section-with-aside .content-container {
        padding: 0 1rem;
    }

    #members-table th, #members-table td {
        padding: 0.5rem 0.5rem;
    }

    .arrow-right {
        margin-right: 0.5rem;
    }

    .desktop-only {
        display: none;
    }
    
    .raid-progress {
        padding: 1rem;
        flex: 1 1 250px;
        min-width: 250px;
    }

    .raid-progress-headline {
        font-size: 1.1rem;
    }
    
    .raid-progress h3 {
        font-size: 1.1rem;
    }
    
    .difficulty {
        font-size: 0.85rem;
    }
}
