/* CrewCanvas - Premium Responsive Design System */
:root {
    --primary-orange: #ff8c00;
    --accent-red: #ff4c3b;
    --sidebar-bg: #111111;
    --content-bg: #ffffff;
    --white: #ffffff;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --sidebar-text: #9ca3af;
    --nav-active-gradient: linear-gradient(90deg, #ff8c00, #ff4c3b);
    --shadow-premium: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 15px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--primary-orange);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
    font-display: swap;
    font-display: swap;
    -webkit-tap-highlight-color: transparent; /* CC-S1-201: Mobile Tap Fix [N Navilash] - Disable tap-highlight */
}

body {
    background-color: var(--content-bg);
    color: var(--text-dark);
    min-height: 100vh;
}

/* Global constraint to never allow horizontal scrolling on mobiles */
html, body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    box-sizing: border-box;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* --- SIDEBAR (Desktop: 1025px+) --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: #000000;
    padding: 30px 20px;
    z-index: 1000;
    display: none; /* Shown via media query */
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar .brand {
    padding-left: 15px;
    margin-bottom: 50px;
}

.sidebar .brand h2 {
    color: var(--primary-orange);
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -1px;
    margin: 0;
}

.sidebar .brand p {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar .nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
}

.sidebar .nav-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .nav-item:hover { 
    color: white; 
    background: rgba(255,255,255,0.08); 
    transform: translateX(4px);
}

.sidebar .nav-item.active { 
    background: var(--primary-orange); 
    color: white !important; 
    box-shadow: 0 10px 25px rgba(255, 140, 0, 0.25);
    font-weight: 700;
}

.sidebar .nav-item .icon, .sidebar .nav-item i { 
    font-size: 18px; 
    margin-right: 15px; 
    width: 24px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- BOTTOM NAV (Mobile) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: #000000;
    display: none; /* Shown on mobile only */
    justify-content: space-around;
    align-items: center;
    z-index: 10000;
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 -5px 25px rgba(0,0,0,0.5);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    text-decoration: none;
    font-size: 9px;
}

.bottom-nav .nav-item.active { color: var(--primary-orange); }

/* --- MAIN CONTENT & HEADER --- */
.main-content {
    width: 100%;
    min-height: 100vh;
}

.top-header {
    width: 100%;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000; /* Higher than overlays */
    background: white;
    border-bottom: 1px solid #f1f5f9;
    height: 70px;
    box-sizing: border-box;
}

.main-content, .main-wrapper {
    padding-top: 70px; /* Space for fixed header */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-logo {
    color: var(--primary-orange);
    font-size: 20px;
    font-weight: 900;
    margin: 0;
    cursor: pointer;
    letter-spacing: -0.6px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
}

.notification-bell-icon {
    color: #fcd34d;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.notification-bell-icon:hover {
    transform: scale(1.1);
}

.status-bar {
    display: flex;
    gap: 15px;
    align-items: center;
    position: relative;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-dark);
    cursor: pointer;
    margin-right: 15px;
}

.user-profile-box {
    padding: 3px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    position: relative;
}
.user-profile-box:hover { 
    background: #fafafa;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06); 
}

.user-initials {
    width: 24px;
    height: 24px;
    background: #ff8c00;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 10px;
    box-shadow: none;
}

/* Profile Dropdown - Updated to Match User's White Premium Design */
.profile-dropdown-menu {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    width: 240px;
    background: #ffffff;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    padding: 12px;
    z-index: 20000;
    border: 1px solid rgba(0, 0, 0, 0.05);
    flex-direction: column;
}

.profile-dropdown-menu.active { 
    display: flex; 
    flex-direction: column;
    gap: 4px;
    animation: dropdownSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
}

@keyframes dropdownSlide { 
    from { opacity: 0; transform: translateY(15px) scale(0.95); } 
    to { opacity: 1; transform: translateY(0) scale(1); } 
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #1f2937;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.dropdown-item:hover { 
    background: #f8fafc; 
    transform: translateX(4px);
}

.dropdown-item i, .dropdown-item .icon-span {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Specific item colors from user image */
.dropdown-item.profile-link i { color: #5a4fcf; }    /* My Profile - Purple */
.dropdown-item.edit-link i { color: #ff4c3b; }       /* Edit Profile - Red/Orange */
.dropdown-item.settings-link i { color: #94a3b8; }   /* Settings - Grey */
.dropdown-item.logout-link { color: #ef4444 !important; } /* Logout - Red Text */
.dropdown-item.logout-link i { color: #3b82f6; }   /* Logout - Blue Icon as in image */

.dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.05);
    margin: 8px 12px;
}

/* --- Notifications System --- */
.notifications-dropdown {
    display: none;
    position: absolute;
    top: 65px;
    right: 0;
    width: 350px;
    background: #ffffff;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    z-index: 9999;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: dropdownSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-pill {
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: auto;
}

/* --- Notifications Tag Styles --- */
.notif-type-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tag-follow { background: #e0f2fe; color: #0369a1; }
.tag-like { background: #fee2e2; color: #b91c1c; }
.tag-comment { background: #f0fdf4; color: #15803d; }
.tag-message { background: #fef9c3; color: #a16207; }
.tag-event { background: #ede9fe; color: #6d28d9; }

/* --- RESPONSIVE LOGIC --- */
@media (min-width: 1025px) {
    .sidebar { display: flex !important; }
    .bottom-nav { display: none !important; }
    body.with-sidebar .main-content, 
    body.with-sidebar .main-wrapper, 
    body.with-sidebar .app-layout .main-wrapper { 
        margin-left: 280px !important; 
        width: calc(100% - 280px) !important; 
    }
    /* Fixed header should also be offset on desktop to not cover sidebar */
    body.with-sidebar .top-header {
        left: 280px !important;
        right: 0 !important;
        width: auto !important;
    }
    .mobile-settings-btn { display: none; }
    .sidebar-toggle { display: none !important; }
}

@media (max-width: 1024px) {
    /* CC-S1-201: Mobile Tap Fix [N Navilash] - Hard-lock viewport and disable tap-highlight */
    /* Hard limit any rogue elements pushing the screen wide */
    img, video, iframe, .card, .content-body {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .main-content { 
        padding-top: 60px; /* Reduced from 70px */
        padding-bottom: 90px; /* Space for bottom nav */
        width: 100% !important;
    }

    .top-header {
        padding: 5px 15px;
        justify-content: space-between !important;
        background: white;
        height: 60px; /* Reduced from 70px */
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        display: flex !important;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        padding-top: 60px !important; /* Match header height */
    }
    
    .search-bar-container {
        display: none !important; /* Hide search on mobile header to save space */
    }

    .sidebar {
        display: none !important; /* Hide sidebar completely on mobile as per user request */
    }
    
    .sidebar.active {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
    .sidebar-overlay.active { display: none !important; }
    
    .sidebar-close-btn {
        display: block !important;
        position: absolute;
        top: 20px;
        right: 20px;
        color: white;
        font-size: 24px;
        cursor: pointer;
    }

    .user-profile-box { 
        display: flex; 
        padding: 6px 12px;
        gap: 8px;
    }
    .user-profile-box span { font-size: 12px; }
    
    .status-bar { justify-content: flex-end; width: auto; display: flex; gap: 10px; }
    
    .profile-dropdown-menu {
        right: 0px;
        top: 50px;
        width: 180px;
    }
    
    .bottom-nav {
        display: flex; /* Re-enable on mobile */
    }
    .bottom-nav .nav-item {
        flex: 1;
        min-width: 0;
        text-align: center;
        padding: 10px 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: #94a3b8;
        text-decoration: none;
        transition: all 0.3s ease;
    }
    .bottom-nav .nav-item.active {
        color: var(--primary-orange);
    }
    .bottom-nav .nav-item span {
        display: block;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .bottom-nav .nav-item .icon, .bottom-nav .nav-item i {
        font-size: 20px;
    }
}

/* Mobile Padding & Grid Utilities */
@media (max-width: 600px) {
    .content-body { padding: 15px; }
    .card { padding: 15px; border-radius: 12px; }
    .stats-grid, .info-grid, .quick-actions { 
        grid-template-columns: 1fr !important; 
        gap: 15px !important;
    }
}

.content-body { padding: 20px; }
.card { background: white; border-radius: 16px; padding: 20px; box-shadow: var(--shadow-premium); }

.auth-btn {
    width: 100%;
    background: linear-gradient(90deg, var(--primary-orange), var(--accent-red));
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 77, 77, 0.2);
}
/* Mobile Optimization for Header */
@media (max-width: 768px) {
    .top-header {
        padding: 15px;
    }

    .top-banner {
        height: 70px;
        padding: 0 15px;
    }

    /* Hide everything EXCEPT the User Menu on the top right */
    .notify-btn, 
    .search-box-wrapper,
    .top-banner::before { 
        display: none !important; 
    }

    .status-bar {
        gap: 0;
    }

    /* Ensure the User Menu is prominent and circular */
    .user-profile-box {
        background: #f1f5f9;
        padding: 3px;
        border: 1px solid #e2e8f0;
        border-radius: 50%;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        width: 32px;
        height: 32px;
    }
}
.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 77, 77, 0.3);
}

/* --- MODALS --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 14, 0.85);
    backdrop-filter: blur(8px);
    z-index: 20000;
    display: none; /* Hidden by default */
    align-items: flex-start; /* Changed from center to allow scrolling from top */
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto; /* Added to handle tall modals */
}
.modal[style*="display: none"] { display: none !important; }

.modal-content {
    background: var(--white);
    border-radius: 28px;
    width: 100%;
    max-width: 600px;
    padding: 40px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalAppear { from { opacity: 0; transform: scale(0.9) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

@media (min-width: 1025px) { .modal { padding-left: 280px; } }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.close { font-size: 28px; cursor: pointer; color: #94a3b8; transition: 0.2s; }
.close:hover { color: var(--accent-red); }

/* --- Global Avatar Sizing --- */
.avatar-fallback, .user-img, .chat-list-avatar, .conv-avatar, .chat-header-avatar, .msg-avatar, .post-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 14px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.profile-big-avatar, .profile-preview-img {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    font-size: 20px !important;
}

.nav-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
}

/* Edit Modal Styles - Shared across Feed and Profile */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 20000;
    backdrop-filter: blur(8px);
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background: white !important;
    width: 100% !important;
    max-width: 600px !important;
    border-radius: 24px !important;
    padding: 30px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    margin: auto !important;
}

@keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
}

.close-btn {
    background: #f1f5f9;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

#editPostContent {
    width: 100% !important;
    height: 150px !important;
    padding: 20px !important;
    border: 2px solid #f1f5f9 !important;
    border-radius: 16px !important;
    margin-bottom: 20px !important;
    resize: none !important;
    font-family: inherit !important;
    font-size: 16px !important;
    background: #f8fafc !important;
    transition: all 0.3s !important;
    color: #333 !important;
}

#editPostContent:focus {
    border-color: #ff8c00 !important;
    background: white !important;
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.1) !important;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.preview-item:hover img {
    transform: scale(1.05);
}

.remove-img-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 5;
    transition: all 0.2s;
}

.remove-img-btn:hover {
    background: #ff0000;
    transform: scale(1.1);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.secondary-btn {
    background: #f1f5f9;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    color: #475569;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.secondary-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

