/* Reddit-Insight Mobile-Optimized Styles */

/* Touch Optimization */
button, a, .clickable {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

/* Hamburger Menu */
.hamburger-menu {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.hamburger-menu span {
    display: block;
    width: 20px;
    height: 2px;
    background: #374151;
    margin: 3px 0;
    transition: 0.3s;
}

/* Mobile Sidebar */
.sidebar {
    transition: transform 0.3s ease;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 60px;
    justify-content: center;
}

.bottom-nav-item:hover {
    background: #f8fafc;
}

.bottom-nav-icon {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.bottom-nav-label {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 500;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border-left: 4px solid #3b82f6;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.toast-success {
    border-left-color: #10b981;
}

.toast.toast-error {
    border-left-color: #ef4444;
}

.toast.toast-warning {
    border-left-color: #f59e0b;
}

/* User Profile Mobile Optimization */
.user-profile {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-height: 44px;
    min-width: 44px;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.profile-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
    display: none;
    overflow: hidden;
}

.profile-dropdown.show {
    display: block;
}

.profile-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-avatar-large {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.profile-menu-item {
    display: block;
    padding: 12px 20px;
    color: #374151;
    text-decoration: none;
    transition: background 0.3s;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    background: none;
    min-height: 44px;
}

.profile-menu-item:hover {
    background: #f8fafc;
}

.profile-menu-item.logout {
    color: #ef4444;
    border-top: 1px solid #f1f5f9;
}

/* Install App Button */
.install-app {
    position: fixed;
    bottom: 80px;
    right: 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
    z-index: 999;
    min-height: 44px;
    display: none;
}

.install-app:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Show mobile elements */
    .hamburger-menu {
        display: flex;
    }
    
    .bottom-nav {
        display: flex;
    }
    
    /* Hide desktop elements */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 1000;
        width: 280px;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .main-content {
        padding: 80px 16px 80px 16px;
    }
    
    /* Adjust user profile for mobile */
    .user-profile {
        top: 15px;
        right: 15px;
    }
    
    .profile-dropdown {
        width: 260px;
        right: -10px;
    }
    
    /* Touch-friendly spacing */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .action-btn {
        width: 100%;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .profile-dropdown {
        width: calc(100vw - 40px);
        right: -10px;
    }
    
    .toast-container {
        right: 10px;
        left: 10px;
    }
    
    .toast {
        max-width: none;
    }
}

/* Admin-only elements */
.admin-only {
    display: none;
}

body.admin-user .admin-only {
    display: flex;
}

/* Micro-animations */
.stat-card {
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.nav-item {
    transition: all 0.3s ease;
}

.nav-item:hover {
    transform: translateX(5px);
}

/* Swipe indicators */
.swipe-indicator {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10000;
}

.swipe-indicator.show {
    opacity: 1;
}
