/* ==========================================
   1. DYNAMIC THEME VARIABLES (FROSTED GLASS)
   ========================================== */
:root { 
    /* Core Layout Tokens */
    --blur-strength: 18px; 
    --nav-height: 100px; 
    
    /* Light Mode Brand Colors */
    --text-color: #1a1a1a; 
    --accent-color: #03A75B; /* Main brand green */
    --group-color: #0078D7; 
    --alert-red: #ff4b2b; 

    /* Light Mode Frosted Elements */
    --glass-bg: rgba(255, 255, 255, 0.45); 
    --glass-border: rgba(255, 255, 255, 0.4); 
    --glassusr-bg: rgba(255, 255, 255, 0.98); 
    --item-bg: rgba(255, 255, 255, 0.25);   /* Buttons & Cards */
    --input-bg: rgba(255, 255, 255, 0.1);    /* Form inputs */
    --subtle-border: rgba(0, 0, 0, 0.05);    /* Dividers */
    --box-bg: rgba(0, 0, 0, 0.05);           /* Containers */
    --profile-toggle-bg: #ffffff;
}

body.dark-mode { 
    /* Dark Mode Brand Colors */
    --text-color: #f8fafc; 
    --accent-color: #02C36A; /* High-contrast vibrant green for perfect brand consistency */
    
    /* Dark Mode Frosted Overlays (Transitions background image elegantly) */
    --glass-bg: rgba(15, 23, 42, 0.65);      /* Deep rich slate tint instead of pitch black */
    --glass-border: rgba(255, 255, 255, 0.12); 
    --glassusr-bg: rgba(22, 28, 45, 0.98); 
    --item-bg: rgba(255, 255, 255, 0.08);    /* Subdued transparent components */
    --input-bg: rgba(0, 0, 0, 0.25);          /* Deep input backgrounds */
    --subtle-border: rgba(255, 255, 255, 0.08);/* Clean light lines on dark backgrounds */
    --box-bg: rgba(255, 255, 255, 0.03);
    --profile-toggle-bg: #1e293b;
}

/* ==========================================
   2. CORE BASE STYLING
   ========================================== */
body {
    /* Removed solid background-color so image shines through natively */
    color: var(--text-color);
    transition: color 0.3s ease;
}

body, html { 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', Roboto, sans-serif; 
    color: var(--text-color); 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    overflow-x: hidden; 
}

.background-container { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-image: url('image_0.jpg'); 
    background-size: cover; 
    background-position: center; 
    z-index: -2; 
}

.frosting-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: var(--glass-bg); 
    backdrop-filter: blur(var(--blur-strength)); 
    z-index: -1; 
    transition: background 0.3s ease; /* Smooth transition when shifting modes */
}

/* ==========================================
   3. NAVIGATION & INTERFACE COMPONENTS
   ========================================== */
.top-nav { 
   position: sticky;
    top: 0; 
    width: 100%; 
    min-height: var(--nav-height); 
    background: var(--glass-bg); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 10px 40px; 
    box-sizing: border-box; 
    z-index: 1000; 
    border-bottom: 1px solid var(--glass-border); 
    border-bottom-left-radius: 45px; 
    border-bottom-right-radius: 45px; 
    backdrop-filter: blur(25px); 
    box-shadow: 0 8px 32px rgba(0,0,0,0.1); 
    transition: background 0.3s, border-color 0.3s;
}

.logo img { height: 60px; width: auto; }
.nav-links { display: flex; gap: 12px; align-items: center; }

.nav-links a { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    min-width: 130px; 
    padding: 10px 18px; 
    border-radius: 25px; 
    background: var(--item-bg); /* Now uses variable */
    text-decoration: none; 
    color: var(--text-color); 
    font-size: 0.95em; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.3s; 
    border: 1px solid var(--glass-border); 
}
.nav-links a:hover { background: var(--accent-color); color: white; }

.nav-right-icons { display: flex; align-items: center; gap: 15px; }
.notification-badge { padding: 10px 18px; border-radius: 30px; font-weight: bold; background: var(--accent-color); color: white; cursor: pointer; display: flex; align-items: center; gap: 8px; border: 1px solid var(--glass-border); transition: background-color 0.3s; }
.notification-badge.alert { background: var(--alert-red); }

@keyframes bell-ring { 0% { transform: rotate(0); } 15% { transform: rotate(15deg); } 30% { transform: rotate(-15deg); } 45% { transform: rotate(10deg); } 60% { transform: rotate(-10deg); } 100% { transform: rotate(0); } }
.ring-active i { animation: bell-ring 0.5s ease-in-out infinite; display: inline-block; }

.user-menu-wrapper { position: relative; }
.nav-profile-toggle { cursor: pointer; border-radius: 50%; border: 3px solid var(--accent-color); width: 45px; height: 45px; overflow: hidden; background: var(--profile-toggle-bg); }

.user-dropdown { display: none; position: absolute; top: 60px; right: 0; width: 260px; background: var(--glassusr-bg); border-radius: 20px; padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); border: 1px solid var(--glass-border); z-index: 2001; }
.user-dropdown.show { display: block; }
.user-dropdown a { display: block; padding: 10px 0; color: inherit; text-decoration: none; cursor: pointer; border-bottom: 1px solid var(--subtle-border); }

.session-info-hidden { display: none; font-size: 0.7em; background: rgba(0,0,0,0.05); padding: 10px; border-radius: 10px; margin-top: 10px; word-break: break-all; }
.session-toggle-btn { cursor: pointer; font-size: 0.75em; color: var(--accent-color); text-align: center; display: block; margin-top: 10px; text-decoration: underline; }

/* ==========================================
   4. CONTENT LAYOUT & CARDS
   ========================================== */
.content-wrapper { flex: 1;margin: 40px auto 60px auto; padding: 0 20px; max-width: 900px; width: 100%; box-sizing: border-box; }
.content-section { background: var(--glass-bg); padding: 35px; border-radius: 35px; border: 1px solid var(--glass-border); margin-bottom: 25px; backdrop-filter: blur(20px); transition: background 0.3s, border-color 0.3s; }

.calendar-item { display: flex; gap: 15px; align-items: center; padding: 15px; background: var(--item-bg); border-radius: 20px; border: 1px solid var(--glass-border); }
.cal-date { background: var(--accent-color); color: white; min-width: 55px; height: 55px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: bold; }

.footer-frosted { width: 100%; box-sizing: border-box; background: var(--glass-bg); backdrop-filter: blur(25px); border-top: 1px solid var(--glass-border); padding: 40px; text-align: center; border-top-left-radius: 50px; border-top-right-radius: 50px; margin-top: auto; }

@media (max-width: 768px) {
    .content-wrapper { 
        margin-top: 40px !important; 
    }
}

/* ==========================================
   5. PROFILE & MANAGEMENT DASHBOARD
   ========================================== */
.edit-profile-container { display: flex; flex-direction: column; gap: 20px; }
.edit-row { display: flex; flex-direction: column; padding-bottom: 20px; border-bottom: 1px solid var(--subtle-border); transition: 0.3s; }
.edit-row.hidden-mode { opacity: 0.5; }
.label-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.label-bar label { font-size: 0.85em; font-weight: 700; display: flex; align-items: center; gap: 8px; }

.privacy-toggle { cursor: pointer; font-size: 0.8em; font-weight: bold; transition: 0.2s; padding: 6px 12px; border-radius: 15px; background: var(--item-bg); border: 1px solid var(--glass-border); color: var(--text-color); }
.privacy-toggle:hover { background: var(--accent-color); color: white; }
.privacy-toggle.active { color: var(--accent-color); }

.inline-input { background: var(--input-bg); border: 1px solid var(--glass-border); padding: 12px 15px; border-radius: 12px; color: var(--text-color); outline: none; width: 100%; font-family: inherit; resize: vertical; box-sizing: border-box; }
.stealth-box { background: var(--box-bg); padding: 20px; border-radius: 25px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; border: 1px dashed var(--glass-border); }

.profile-card { margin-bottom: 0 !important; flex-direction: column !important; text-align: center; padding: 25px !important; gap: 12px !important; transition: transform 0.2s; cursor: pointer; }
.profile-card:hover { transform: translateY(-5px); }
.profile-card div { margin: 0 auto; }

#expand-panel { position: fixed; bottom: -600px; right: 30px; width: 400px; height: 600px; background: var(--glass-bg); transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); z-index: 1050; backdrop-filter: blur(30px); border-top-left-radius: 40px; border-top-right-radius: 40px; border: 1px solid var(--glass-border); box-shadow: 0 -15px 45px rgba(0, 0, 0, 0.25); }
#expand-panel.open { bottom: 0; }
#tab-trigger { position: absolute; top: -42px; left: 50%; transform: translateX(-50%); width: 150px; height: 42px; background: var(--glassusr-bg); color: var(--text-color); border-top-left-radius: 25px; border-top-right-radius: 25px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 800; border: 1px solid var(--glass-border); border-bottom: none; }

@media (max-width: 500px) { #expand-panel { width: 100%; right: 0; border-radius: 30px 30px 0 0; } }

.btn-action {
    padding: 10px 20px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    background: var(--accent-color);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-action:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

/* ==========================================
   6. EMOJI MANAGEMENT
   ========================================== */
#emojiPicker {
    position: absolute;
    bottom: 80px;
    left: 10px;
    right: 10px;
    background: var(--glassusr-bg);
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    z-index: 1060;
    height: 250px; 
    display: none; 
    flex-direction: column;
}

#emojiScrollArea {
    flex: 1; 
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
    margin-top: 10px;
    height: 175px; 
}

#emojiTabs {
    display: flex;
    justify-content: space-around;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid var(--glass-border);
}

.tab-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    border-radius: 5px;
    color: var(--text-color);
    transition: background 0.2s;
}
.tab-btn:hover { background: var(--glass-border); }

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); 
    gap: 6px;
    padding: 5px;
    justify-items: center;
}

.emoji-grid span {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;      
    width: 38px;          
    height: 38px;         
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.emoji-grid span:hover {
    background-color: var(--glass-border); 
    transform: scale(1.15); 
}

.emoji-cat { display: none; }
#emojiScrollArea::-webkit-scrollbar { width: 6px; }
#emojiScrollArea::-webkit-scrollbar-thumb { background-color: var(--glass-border); border-radius: 3px; }

#directoryGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.profile-card:hover {
    transform: translateY(-5px);
    transition: 0.3s;
    background: var(--glassusr-bg) !important;
}

/* ==========================================
   7. RESPONSIVE NAVIGATION ADJUSTMENTS
   ========================================== */
@media (max-width: 768px) {
    .top-nav {
        flex-wrap: wrap;              
        justify-content: space-between; 
        padding: 12px 20px;
        min-height: unset;            
        border-bottom-left-radius: 25px;
        border-bottom-right-radius: 25px;
    }

    .logo { order: 1; }
    .nav-right-icons { order: 2; gap: 10px; }

    .nav-links {
        order: 3;
        width: 100%;                  
        justify-content: space-between;
        margin-top: 12px;             
        gap: 8px;
    }

    .nav-links a {
        min-width: unset;             
        flex: 1;                      
        padding: 8px 10px;
        font-size: 0.85em;
        justify-content: center;
    }

    .nav-links a span { display: inline-block; }
    .content-wrapper { margin-top: 175px !important; }
}

/* Footer Link Underline Animation */
.footer-frosted a {
    position: relative;
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

.footer-frosted a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 50%;
    background-color: var(--accent-color);
    transition: all 0.3s ease;
}

.footer-frosted a:hover::after {
    width: 100%;
    left: 0;
}