@import 'common.css';

/* Public Layout */
header {
    background: linear-gradient(135deg, #2563eb 0%, #38bdf8 100%); /* Blue 600 to Sky 400 - "Hope of Heaven" */
    color: white;
    padding: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000; /* Maximize to stay on top */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    height: 4rem;
}

.logo-area {
    flex: 1;
    display: flex;
    align-items: center;
}

header h1 {
    font-size: 1.35rem;
    margin: 0;
    color: white;
    font-weight: 800;
    letter-spacing: -0.025em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

header h1 a {
    color: white;
    text-decoration: none;
}

/* Navigation */
#nav-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

#nav-menu a, .dropbtn {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    border-radius: 0.375rem;
}

#nav-menu a:hover, #nav-menu a.active, .dropbtn:hover {
    color: white;
    font-weight: 700;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: -0.5rem; /* Align flush right */
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.mobile-menu-btn:hover, .mobile-menu-btn:active {
    background-color: rgba(255, 255, 255, 0.2);
}

.mobile-only {
    display: none;
}

.mobile-sub-header {
    display: none;
}

/* Auth Buttons Area */
.auth-buttons {
    margin-left: 1rem;
    display: flex;
    align-items: center;
}

.auth-buttons a {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-buttons a:hover {
    color: white;
}

.auth-buttons .btn-primary {
    color: #2563eb !important; /* Blue text */
    background-color: white; /* White button */
    padding: 0.375rem 0.875rem;
    border-radius: 0.375rem;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.auth-buttons .btn-primary:hover {
    background-color: #f8fafc;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .header-container {
        padding: 0 1.25rem; /* Slightly more padding on mobile */
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px; /* Sufficient touch target */
        height: 44px;
    }

    #nav-menu {
        display: none;
        position: fixed; /* Fixed to cover screen */
        top: 4rem;
        left: 0;
        width: 100%;
        height: calc(100vh - 4rem);
        background-color: white;
        flex-direction: column;
        align-items: stretch; /* Full width items */
        padding: 0;
        overflow-y: auto;
        border-top: 1px solid #e2e8f0;
        animation: slideDown 0.3s ease-out;
    }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    #nav-menu.active {
        display: flex;
    }

    /* Fix color issue for active items on mobile */
    #nav-menu a.active, 
    #nav-menu .nav-item.active > .dropbtn {
        color: #2563eb !important;
        background-color: #eff6ff !important;
        font-weight: 700;
    }

    .nav-item {
        width: 100%;
        padding: 1.25rem 1.5rem; /* Larger touch area */
        border-bottom: 1px solid #f1f5f9;
        display: flex;
        justify-content: space-between;
        align-items: center;
        color: #1e293b !important; /* Force dark color on mobile */
        font-size: 1.05rem; /* Slightly larger font */
        font-weight: 600;
        background-color: white;
    }
    
    .nav-item:hover {
        background-color: #f8fafc;
        color: #2563eb !important;
    }

    /* Dropdown in Mobile */
    .dropdown {
        display: block;
        padding: 0;
        width: 100%;
    }

    .dropdown .dropbtn {
        width: 100%;
        text-align: left;
        padding: 1.25rem 1.5rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        color: #1e293b !important;
        font-size: 1.05rem;
        font-weight: 600;
        border-bottom: 1px solid #f1f5f9;
        background: white;
        border-radius: 0;
    }
    
    .dropdown .dropbtn:hover {
        background-color: #f8fafc;
        color: #2563eb !important;
    }

    .dropdown-content {
        position: static;
        display: none;
        background-color: #f8fafc; /* Light gray background for sub-menu */
        width: 100%;
        transform: none;
        border-radius: 0;
        padding: 0.5rem 0;
        box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
        border: none !important;
    }

    .dropdown.active .dropdown-content {
        display: block;
    }

    .dropdown.active .dropbtn {
        color: #2563eb !important;
        background-color: #f1f5f9;
    }

    .dropdown.active .dropbtn i.fa-chevron-down {
        transform: rotate(180deg);
    }

    .dropdown-content a {
        padding: 1rem 1.5rem 1rem 2.5rem !important; /* Deep indentation */
        color: #64748b; /* Slate 500 */
        border-bottom: 1px solid #e2e8f0 !important;
        font-size: 0.95rem !important;
        font-weight: 500 !important;
        background-color: transparent !important;
        display: block;
    }
    
    .dropdown-content a:hover {
        color: #2563eb;
        background-color: #eff6ff !important;
        padding-left: 2.75rem !important;
    }
    
    .dropdown-content a:last-child {
        border-bottom: none !important;
    }

    .mobile-menu-btn i {
        transition: transform 0.3s ease;
    }
    
    .mobile-menu-btn.active i {
        transform: rotate(90deg);
    }

    .dropdown:hover .dropdown-content {
        display: none;
    }
    
    .dropdown.active:hover .dropdown-content {
        display: block;
    }

    .mobile-only {
        display: inline-block;
        font-size: 0.9rem;
        transition: transform 0.2s;
    }

    .mobile-sub-header {
        display: block;
        font-weight: 700;
        color: #2563eb !important;
        background-color: #eff6ff; /* Very light blue */
    }

    .auth-buttons {
        width: 100%;
        margin: 0;
        padding: 2rem 1.5rem;
        flex-direction: column; /* Stack buttons on mobile */
        gap: 1rem;
        border-top: 1px solid #e2e8f0;
        background-color: white;
    }
    
    .auth-buttons a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 1rem;
        border-radius: 0.75rem;
        font-size: 1rem;
        font-weight: 600;
    }
    
    .auth-buttons a.btn-primary {
        background-color: #2563eb !important;
        color: white !important;
        box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    }
    
    .auth-buttons a:not(.btn-primary) {
        border: 1px solid #cbd5e1;
        color: #475569;
    }
}

/* Dropdown Menu (Desktop) */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 180px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 100;
    border-radius: 0.5rem;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px); /* Initial offset for animation */
    overflow: hidden;
    padding: 0.5rem 0;
    border: 1px solid #e2e8f0;
    animation: fadeIn 0.2s ease-out forwards;
}

@keyframes fadeIn {
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.dropdown-content a {
    color: #475569;
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
    text-align: left;
    transition: background-color 0.1s;
}

.dropdown-content a:hover {
    background-color: #f8fafc;
    color: #0f172a;
}

.dropdown:hover .dropdown-content {
    display: block;
}

main {
    max-width: 1024px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: calc(100vh - 10rem);
}

footer {
    background-color: white;
    border-top: 1px solid #e2e8f0; /* Slate 200 - Cool Gray Divider */
    padding: 3rem 0;
    text-align: center;
    color: #94a3b8;
    font-size: 0.875rem;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #2563eb 0%, #38bdf8 100%); /* Blue 600 to Sky 400 - Matching Header */
    color: white;
    padding: 5rem 1rem;
    border-radius: 1rem;
    text-align: center;
    margin-bottom: 4rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Dropdown Content Links */
.dropdown-content a {
    color: #334155 !important; /* Slate 700 - Ensure visibility */
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
    text-align: left;
    transition: all 0.2s;
}

.dropdown-content a:hover {
    background-color: #f0f9ff; /* Very light blue hover */
    color: #0284c7 !important; /* Sky 600 text on hover */
    padding-left: 1.25rem; /* Slide effect */
}

.hero-title {
    color: #ffffff !important; /* Pure White */
    margin-bottom: 1.25rem;
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    position: relative;
    text-shadow: 0 2px 10px rgba(15, 23, 42, 0.3); /* Subtle dark shadow for clarity */
}

.hero-subtitle {
    font-size: 1.125rem;
    color: #cbd5e1; /* Slate 300 */
    max-width: 600px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
    font-weight: 400;
    position: relative;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    position: relative;
}

/* Mini Portal */
.mini-portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-bottom: 4rem;
}

.mini-portal-card h3 {
    border-bottom: 1px solid #e2e8f0; /* Cool Gray Divider */
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #334155;
}

/* Dedication Section */
.dedication-section {
    margin-bottom: 4rem;
}

.dedication-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

@media (min-width: 768px) {
    .dedication-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.dedication-featured {
    background-color: #f8fafc;
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
}

/* Community CTA */
.community-cta {
    background-color: #f8fafc; /* Very light slate */
    border-radius: 1rem;
    padding: 4rem 1rem;
    text-align: center;
    margin-top: 4rem;
    border: 1px solid #e2e8f0;
}

/* Responsive Nav (Mobile Overhaul) */
@media (max-width: 768px) {
    .header-container {
        flex-direction: row !important;
        height: 4rem;
        padding: 0 1.25rem;
        justify-content: space-between;
        align-items: center;
    }

    header h1 {
        font-size: 1.15rem;
        z-index: 1001;
    }

    .mobile-menu-btn {
        display: flex !important;
        z-index: 1001;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 0.75rem;
    }

    #nav-menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: white;
        flex-direction: column;
        align-items: stretch;
        padding: 5rem 0 2rem 0; /* Padding for fixed header area */
        overflow-y: auto;
        z-index: 1000;
    }

    #nav-menu.active {
        display: flex;
    }

    /* Base Style for all items in Mobile Menu */
    .nav-item, .dropdown .dropbtn {
        width: 100%;
        padding: 1.25rem 1.5rem !important;
        color: #1e293b !important; /* Deep Slate - Very Readable */
        font-size: 1.125rem !important;
        font-weight: 700 !important;
        text-align: left;
        border-bottom: 1px solid #f1f5f9;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: white;
        transition: background-color 0.2s;
    }

    .nav-item:hover, .dropdown .dropbtn:hover {
        background-color: #f8fafc;
    }

    /* Sub-menu (Accordion) Styling */
    .dropdown-content {
        display: none;
        position: static;
        width: 100%;
        background-color: #f8fafc; /* Light gray for contrast */
        padding: 0.5rem 0;
        transform: none;
        box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
        border: none !important;
    }

    .dropdown.active .dropdown-content {
        display: block;
    }

    .dropdown.active .dropbtn {
        color: #2563eb !important; /* Blue highlight when open */
        background-color: #f1f5f9;
    }

    .dropdown-content a {
        padding: 1rem 1.5rem 1rem 2.5rem !important;
        color: #475569 !important; /* Medium Slate */
        font-size: 1rem !important;
        font-weight: 600 !important;
        border-bottom: 1px solid #edf2f7 !important;
        display: block;
        background-color: transparent !important;
    }

    .dropdown-content a:last-child {
        border-bottom: none !important;
    }

    /* User Profile Area in Mobile Menu */
    .auth-buttons-container {
        margin-top: auto; /* Push to bottom */
        padding: 2rem 1.5rem;
        background-color: #f8fafc;
        border-top: 1px solid #e2e8f0;
    }

    .user-nav-item {
        border: none !important;
        padding: 0 !important;
    }

    .user-nav-item .dropbtn {
        background-color: white !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 1rem !important;
        margin-bottom: 0.5rem;
    }

    .user-name-text {
        color: #1e293b !important;
        font-weight: 800;
    }

    .logout-link {
        color: #ef4444 !important; /* Explicit Red */
        font-weight: 700 !important;
    }

    .login-nav-item {
        background-color: #2563eb !important;
        color: white !important;
        justify-content: center !important;
        border-radius: 1rem;
        margin: 0 1.5rem;
        width: auto !important;
    }
}
