/* --- 1. SETTINGS & VARIABLES --- */
:root {
	--ui-font: 'Inter', system-ui, -apple-system, sans-serif;
	--body-serif: 'Georgia', serif;
    --bg-color: #0A0E12;
    --border-bottom: #3B4C5E;
    --linen: #E6E9ED;
    --hccc-gold: #e2b714;
    --gold-glow: rgba(216, 142, 24, 0.8);
    --glass-bg: rgba(20, 26, 32, 0.7);
    --title-bg: rgba(20, 26, 32, 0.3);
    --nav-bg: rgba(20, 26, 32, 0.8);
    --footer-bg: rgba(20, 26, 32, 0.8);
    --input-white-bg: rgba(255, 255, 255, 0.05);
    --hero-border: rgba(255, 255, 255, 0.1);
    --warm-border: rgba(115, 54, 16, 0.3);
    --member-border-soft: rgba(115, 54, 16, 0.2);
    --slideout-shadow: rgba(0, 0, 0, 0.2);
}

/* --- 2. BASE STYLES --- */
*, *:before, *:after { box-sizing: inherit; }
html { box-sizing: border-box; -webkit-text-size-adjust: 100%; }

body {
    margin: 0; padding: 0;
    color: var(--linen);
    font-family: var(--ui-font);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh; min-height: 100svh;
}

.background-overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: url('/graphics/hccc_bg2.png') center/cover fixed;
    z-index: -1;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, #next-event-pill { font-family: var(--body-serif); }

a {
    color: var(--gold-glow);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

a:hover {
    color: #FFF;
    text-shadow: 0 0 8px var(--gold-glow), 0 0 12px var(--hccc-gold);
}

/* --- 3. LAYOUT & NAVIGATION --- */
#nav-placeholder {
    /* Forces Safari to treat this as a hardware-accelerated layer */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* Ensures injected content isn't treated as "overflow" */
    will-change: transform; 
	min-height: 48px; /* Match the final height of your flex-nav */
    display: block;
    width: 100%;
}

.flex-center { display: flex; align-items: center; justify-content: center; }

.flex-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.5rem 8%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--border-bottom);
    position: sticky; position: -webkit-sticky; top: 0;
    z-index: 200; font-weight: 500; font-family: var(--body-serif);
    overflow: visible !important;
}

.nav-links { display: flex; gap: 30px; justify-content: center; padding: 0 32px; -webkit-box-pack: center; }
.flex-nav a { font-size: 1.1rem; }

.nav-action {
    z-index: 1000; display: flex; align-items: center; justify-content: flex-end;
    overflow: visible !important; min-width: 160px; min-height: 44px;
}

.nav-options, #push-nav-item { display: flex; align-items: center; }

#nav-avatar-img {
    width: 32px !important; height: 32px !important;
    border-radius: 50%; border: 2px solid var(--hccc-gold);
    object-fit: cover; flex-shrink: 0;
}

/* --- 4. BUTTONS & UI --- */
#nav-logout-btn, #nav-join-btn, #nav-login-btn, .btn-wood, .gold-button {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--border-bottom); color: white;
    border-radius: 4px; font-weight: bold; border: none; cursor: pointer;
    text-transform: uppercase; font-size: 0.85rem; white-space: nowrap !important;
    transition: all 0.3s ease; flex-shrink: 0 !important;
}

#nav-logout-btn, #nav-join-btn, #nav-login-btn { 
    padding: 8px; margin: 0 4px;
    font-family: var(--ui-font) !important; 
}

.btn-wood, .gold-button { z-index:1000; min-height: 40px; padding: 0 16px; width: auto; box-sizing: border-box; }
.btn-wood:hover, .gold-button:hover { background-color: #4d5d6e; box-shadow: 0 0 10px var(--gold-glow); }

.btn-icon { background: none; border: none; font-size: 1.5rem; cursor: pointer; padding: 5px; filter: sepia(0.5); transition: transform 0.2s; }
.btn-icon:hover { transform: scale(1.2); }

/* --- 5. CARDS & CONTENT --- */
.main-content { max-width: 1100px; margin: 0 auto; padding: 30px 20px; }

.hero-box {
    text-align: center; padding: 50px 20px;
    background: var(--title-bg); border: 1px solid var(--hero-border);
    border-radius: 15px; margin-bottom: 30px;
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}

.resource-container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; }

.resource-card, .resource-card2 {
    background: var(--glass-bg); border: 1px solid var(--warm-border);
    border-radius: 12px; text-align: center; transition: transform 0.3s ease;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    -webkit-transform: translateZ(0);
}

.resource-card { flex: 1 1 300px; padding: 40px 20px; }
.resource-card2 {
    width: 100%;
    max-width: 500px; /* Match the width of your main form */
    padding: 20px;
    background: rgba(0, 0, 0, 0.4); /* Glass effect to match the main card */
    border: 1px solid var(--warm-border);
    border-radius: 8px;
    box-sizing: border-box;
}
.resource-card img.card-icon-img { width: 100%; height: 180px; object-fit: cover; margin-bottom: 20px; border-radius: 8px; }

.card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* --- 6. FORMS & INPUTS --- */
input, textarea {
    background: var(--input-white-bg); border: 1px solid var(--warm-border);
    color: var(--linen); padding: 8px; border-radius: 4px; width: 95%;
    box-sizing: border-box; margin: 4px;
}

.alignRegForm {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; /* Reduces the massive gap between Google and Email sections */
}
.grid-inputs { margin-bottom: 16px; }
.oAuthSignIn { width: 100%; display: flex; flex-direction: column; gap: 10px; padding: 16px; margin-bottom: 16px; }
#contact-information-form { width: 50%; display: flex; flex-direction: column; }
.google-login-button { background-color: transparent; border: none; }

.form-container {
    width: 95%; max-width: 800px; margin: 20px auto; padding: 25px;
    background: var(--glass-bg); border: 1px solid var(--warm-border);
    border-radius: 12px; text-align: center; transition: transform 0.3s ease;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    -webkit-transform: translateZ(0);
}

.form-container .edit-row, .form-container .form-actions {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-bottom: 20px;
}

.form-container .edit-column { flex: 1; min-width: 280px; text-align: left; }

.input-with-action { display: flex !important; align-items: center !important; width: 100%; gap: 10px; }
.input-with-action input { flex: 1 !important; width: auto !important; margin: 0 !important; }

.clear-field-btn {
    flex-shrink: 0 !important; background: var(--input-white-bg);
    border: 1px solid var(--warm-border); color: var(--linen);
    padding: 6px 10px; cursor: pointer; border-radius: 4px;
    font-size: 1.1rem; line-height: 1;
}

/* --- 7. ROSTER & CALENDAR --- */
.member-list-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.member-row {
    background: var(--glass-bg); border: 1px solid var(--member-border-soft);
    border-radius: 8px; overflow: hidden; margin-bottom: 10px; transition: background 0.3s ease;
    font-family: var(--ui-font); font-size: 0.85rem; min-width: 200px;
}
.member-summary { display: flex; align-items: center; padding: 12px 20px; cursor: pointer; gap: 15px; }
.member-thumb { width: 32px; height: 32px; object-fit: contain; }
.member-name { flex-grow: 1; font-weight: bold; }
.member-slideout { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1); background: var(--slideout-shadow); }
.member-row.active .member-slideout { max-height: 300px; }
.slideout-content { padding: 15px 20px; border-top: 1px solid var(--warm-border); font-size: 0.9rem; }

.calendar-header-sticky, .vertical-calendar-grid { display: grid; grid-template-columns: 80px repeat(7, 1fr); }
.calendar-header-sticky {
    position: sticky; position: -webkit-sticky; top: 0; z-index: 100;
    background: var(--bg-color); padding: 15px 0 10px 0; border-bottom: 2px solid var(--border-bottom);
}
.vertical-calendar-grid { grid-auto-rows: minmax(110px, 1fr); width: 100%; }

.calendar-day {
    position: relative; display: flex; flex-direction: column;
    background: var(--glass-bg); border: 1px solid var(--warm-border);
    z-index: 1; min-width: 0; padding: 0 !important;
}
.calendar-day:hover { z-index: 10; }

.event-container { position: absolute; top: 30px; left: 8px; right: 8px; bottom: 8px; display: flex; flex-direction: column; pointer-events: none; }
.event-pill {
    background: var(--border-bottom); color: #FFF; padding: 3px 6px; border-radius: 4px;
    font-size: 0.65rem; margin-top: 4px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; width: 100%; pointer-events: auto;
}

.event-details-overlay {
    display: none; position: absolute; top: 5px; left: 105%; width: 280px; max-height: 400px;
    overflow-y: auto; background: var(--glass-bg); padding: 15px; border-radius: 8px;
    border: 1px solid var(--border-bottom); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7); z-index: 3000;
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    scrollbar-width: none; -ms-overflow-style: none;
}
.event-details-overlay::-webkit-scrollbar { display: none; }
.calendar-day:hover .event-details-overlay { display: block; }

.month-sidebar {
    grid-column: 1; writing-mode: vertical-rl; -webkit-writing-mode: vertical-rl;
    transform: rotate(180deg); display: flex; align-items: center; justify-content: center;
    background: var(--border-bottom); color: var(--linen); font-weight: bold;
    letter-spacing: 2px; font-size: 0.75rem; border-radius: 8px 0 0 8px;
    text-transform: uppercase; margin: 2px 0;
}

/* --- 8. CHAT & FOOTER --- */
.chat-tab { position: fixed; bottom: 20px; left: 20px; z-index: 5000; font-family: var(--ui-font); }
.chat-window {
    position: fixed; bottom: 80px; left: 20px; width: 320px; height: 450px;
    background: var(--glass-bg); border: 1px solid var(--border-bottom); border-radius: 12px;
    display: flex; flex-direction: column; transform: translateY(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); z-index: 4999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
}
.chat-window.active { transform: translateY(0); }
.chat-header { padding: 12px; background: var(--border-bottom); color: white; font-weight: bold; font-size: 0.9rem; text-transform: uppercase; }
#chat-messages { flex: 1; padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; scrollbar-width: none; }
#chat-messages::-webkit-scrollbar { display: none; }
.msg { background: rgba(255,255,255,0.05); padding: 8px; border-radius: 6px; font-size: 0.85rem; border-left: 2px solid var(--hccc-gold); }
.chat-input-area { padding: 10px; border-top: 1px solid var(--hero-border); display: flex; gap: 5px; }
#chat-input { width: 100%; margin: 0; }

.flex-footer { padding: 40px 0; margin-top: 20px; background: var(--footer-bg); border-top: 1px solid var(--border-bottom); text-align: center; }

/* --- 9. SPECIAL UTILITIES --- */
.logo { margin-right: 10px; }

/* --- 10. MEDIA QUERIES --- */
@media screen and (max-width: 600px) {
    .main-content { padding: 15px 10px; width: 100%; }
    .flex-nav { padding: 1rem 5%; gap: 15px; flex-direction: column; }
    .nav-links { gap: 0; width: 100%; flex-direction: column; }
    .nav-links a { padding: 12px; display: block; text-align: center; border-bottom: 1px solid var(--hero-border); }
    .nav-action { 
		display: flex !important;
		width: 100%; 
		justify-content: center; 
		padding-top: 10px;
		/* The Safari Fixes */
		min-height: 44px;      /* Ensure it doesn't collapse to 0px */
		overflow: visible;     /* Prevent clipping */
		-webkit-transform: translateZ(0); /* Force GPU paint */
	}
    .btn-wood, .gold-button, #google-login-btn, #push-nav-item { height: 48px; margin: 5px 0; }
    .member-list-container { grid-template-columns: 1fr; gap: 15px; }
    .vertical-calendar-grid, .calendar-header-sticky { grid-template-columns: 30px repeat(7, 1fr) !important; }
    .calendar-day { min-height: 80px; }
    .event-pill { font-size: 0.55rem; padding: 2px; }
    .event-details-overlay { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 85vw; max-height: 70vh; z-index: 4000; box-shadow: 0 0 50px rgba(0,0,0,0.9); }
    #contact-information-form { width: 90%; }
    input, textarea { font-size: 16px !important; }
    .chat-window { width: calc(100% - 40px); height: 60vh; }
}

@supports (-webkit-touch-callout: none) { .background-overlay { height: -webkit-fill-available; } }
@supports not (backdrop-filter: blur(10px)) and (not (-webkit-backdrop-filter: blur(10px))) {
    .resource-card, .resource-card2, .flex-nav, .hero-box { background-color: rgb(20, 26, 32); }
}
@supports not (gap: 30px) { .nav-links > * + * { margin-left: 30px; } }