/* Shared Navigation Styles for REAP Integrity Apps */

/* Header styles */
.reap-header {
    background: rgba(255, 255, 255, 0.9);
    /* backdrop-filter: blur(16px); */
    /* -webkit-backdrop-filter: blur(16px); */
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 50;
    padding-top: env(safe-area-inset-top, 0);
}

.reap-header .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    margin-top: 1rem;
}

.reap-header .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.reap-header .logo {
    font-size: 1.875rem;
    font-weight: 700;
    color: #0d9488;
    letter-spacing: 0.025em;
}

/* Profile dropdown styles */
.profile-dropdown {
    position: relative;
}

.profile-button {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.profile-button:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.profile-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.5);
}

.profile-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-button .initials {
    color: white;
    font-weight: 600;
    font-size: 1.125rem;
}

.profile-dropdown-menu {
    position: absolute;
    right: 0;
    margin-top: 0.5rem;
    width: 14rem;
    max-width: calc(100vw - 2rem);
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0;
    transform-origin: top right;
    transition: all 0.2s ease;
    z-index: 50;
}

/* Ensure dropdown stays within viewport */
@media (max-width: 640px) {
    .profile-dropdown-menu {
        width: calc(100vw - 2rem);
        right: 1rem;
        left: 1rem;
        margin-left: auto;
        margin-right: auto;
    }
}

.profile-dropdown-menu.hidden {
    opacity: 0;
    transform: scale(0.95);
    visibility: hidden;
}

.profile-dropdown-menu.show {
    opacity: 1;
    transform: scale(1);
    visibility: visible;
}

.dropdown-user-info {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dropdown-user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.dropdown-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-user-avatar .initials {
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.dropdown-menu-item {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #374151;
}

.dropdown-menu-item:hover {
    background-color: #f9fafb;
}

.dropdown-menu-item.logout {
    color: #dc2626;
}

.dropdown-menu-item.logout:hover {
    background-color: #fef2f2;
}

.dropdown-menu-item i {
    color: #6b7280;
    width: 1rem;
}

.dropdown-menu-item.logout i {
    color: #ef4444;
}

/* Navigation styles */
.desktop-nav {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
    }
}

.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    z-index: 50;
    display: block;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (min-width: 768px) {
    .mobile-nav {
        display: none;
    }
}

.nav-container {
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
}

.nav-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 0.75rem;
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.desktop-nav .nav-button {
    padding: 0 1rem;
}

.nav-button:hover {
    color: #0d9488;
}

.nav-button.active {
    color: #0d9488;
}

.nav-button i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.nav-button span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Apps Modal */
.apps-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.apps-modal.hidden {
    display: none;
}

/* Force grid layout for apps */
#apps-modal .grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem !important;
}

#apps-modal .grid > * {
    width: 100% !important;
}

.apps-modal-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 28rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.apps-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.apps-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.apps-modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.apps-modal-close:hover {
    color: #6b7280;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem;
}

.app-button {
    padding: 1rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--app-color-from);
}

.app-button:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.app-button i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.app-button .app-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
}

/* App-specific colors */
.app-journaling {
    --app-color-from: #dbeafe;
    --app-color-to: #bfdbfe;
}

.app-journaling i {
    color: #2563eb;
}

.app-goals {
    --app-color-from: #dcfce7;
    --app-color-to: #bbf7d0;
}

.app-goals i {
    color: #16a34a;
}

.app-calendar {
    --app-color-from: #f3e8ff;
    --app-color-to: #e9d5ff;
}

.app-calendar i {
    color: #9333ea;
}

.app-tasks {
    --app-color-from: #fed7aa;
    --app-color-to: #fdba74;
}

.app-tasks i {
    color: #ea580c;
}

.app-workouts {
    --app-color-from: #fee2e2;
    --app-color-to: #fecaca;
}

.app-workouts i {
    color: #dc2626;
}

.app-relationships {
    --app-color-from: #fce7f3;
    --app-color-to: #fbcfe8;
}

.app-relationships i {
    color: #ec4899;
}

.app-accountability {
    --app-color-from: #e0e7ff;
    --app-color-to: #c7d2fe;
}

.app-accountability i {
    color: #4f46e5;
}

.app-assessment {
    --app-color-from: #f0fdfa;
    --app-color-to: #ccfbf1;
}

.app-assessment i {
    color: #14b8a6;
}

.app-projects {
    --app-color-from: #fefce8;
    --app-color-to: #fef3c7;
}

.app-projects i {
    color: #ca8a04;
}

.app-dating {
    --app-color-from: #fff1f2;
    --app-color-to: #ffe4e6;
}

.app-dating i {
    color: #f43f5e;
}

.app-quotes {
    --app-color-from: #ecfeff;
    --app-color-to: #cffafe;
}

.app-quotes i {
    color: #0891b2;
}

.app-4a {
    --app-color-from: #ecfdf5;
    --app-color-to: #d1fae5;
}

.app-4a i {
    color: #059669;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .apps-modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .apps-grid {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .app-button {
        padding: 0.75rem;
    }
    
    .app-button i {
        font-size: 1.25rem;
    }
}

/* Safe area adjustments for mobile devices */
.mobile-nav {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

/* Focus styles for accessibility */
.nav-button:focus,
.app-button:focus,
.dropdown-menu-item:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Animation for smooth transitions */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.mobile-nav {
    animation: slideUp 0.3s ease-out;
}

.apps-modal {
    animation: fadeIn 0.2s ease-out;
}