/* Modern Dark Theme CSS for Anonymous Chat */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    --background-dark: #0f172a;
    --background-card: #1e293b;
    --background-input: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Prevent iOS zoom on focus */
    -webkit-text-size-adjust: 100%;
    /* Better touch handling */
    touch-action: manipulation;
    /* iOS safe area support */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Animated background */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-dark);
    z-index: -1;
}

.animated-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    /* Better touch targets */
    min-height: 44px;
    min-width: 44px;
    -webkit-tap-highlight-color: transparent;
    /* Prevent text selection on mobile */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--background-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background-input);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
    position: relative;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Cards */
.card {
    background: var(--background-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Chat Interface */
.chat-container {
    max-width: 900px;
    margin: 2rem auto;
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: var(--background-card);
    padding: 1rem;
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success-color);
}



.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.chat-actions-subtle {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    background: var(--background-card);
    border-bottom: 1px solid var(--border-color);
}

.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn-friend {
    background: var(--success-color);
    color: white;
}

.action-btn-friend:hover {
    background: #0d9488;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.action-btn-match {
    background: var(--background-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.action-btn-match:hover {
    background: var(--background-dark);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.action-icon {
    font-size: 1rem;
}

.action-text {
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    background: var(--background-card);
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    position: relative;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    align-self: flex-end;
    background: var(--gradient);
    color: white;
}

.message.other {
    align-self: flex-start;
    background: var(--background-input);
    color: var(--text-primary);
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.chat-input {
    background: var(--background-card);
    padding: 1rem;
    border-radius: 0 0 16px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
}

.chat-input input {
    flex: 1;
    background: var(--background-input);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Forms */
.form-container {
    max-width: 400px;
    margin: 2rem auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    background: var(--background-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-error {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--background-card);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-success { color: var(--success-color); }
.text-error { color: var(--error-color); }
.text-warning { color: var(--warning-color); }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }

/* Friends Management Styles */
.badge {
    background: var(--error-color);
    color: white;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    min-width: 1.2rem;
    text-align: center;
}

.friend-requests {
    max-height: 400px;
    overflow-y: auto;
}

.friend-request-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.friend-request-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.friend-request-item:last-child {
    border-bottom: none;
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.friend-name {
    font-weight: 600;
    color: var(--text-primary);
}

.friend-time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.friend-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
}

.btn-sm:hover {
    transform: translateY(-1px);
}

.btn-sm.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-sm.btn-danger {
    background: var(--error-color);
    color: white;
}

.status-pending {
    color: var(--warning-color);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.friend-card {
    background: var(--background-input);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.friend-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
}

.friend-avatar-section {
    text-align: center;
    margin-bottom: 1rem;
}

.user-avatar.large {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    position: relative;
    margin: 0 auto;
}

.user-avatar.online {
    border: 3px solid var(--success-color);
}

.user-avatar.offline {
    border: 3px solid var(--text-muted);
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--background-card);
}

.user-avatar.online .status-dot {
    background: var(--success-color);
}

.user-avatar.offline .status-dot {
    background: var(--text-muted);
}

.friend-details {
    text-align: center;
    margin-bottom: 1.5rem;
}

.friend-details .friend-name {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.friend-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.friend-since {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.friend-actions-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.friend-actions-vertical .btn {
    width: 100%;
    justify-content: center;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

.message-result {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-result.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.message-result.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.form-help {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.notification-badge {
    background: var(--error-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 8px;
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 16px;
    text-align: center;
    line-height: 1;
}

/* Responsive Design */

/* iPhone 14 Series Specific Optimizations */
@media only screen 
  and (device-width: 390px) 
  and (device-height: 844px) 
  and (-webkit-device-pixel-ratio: 3) {
    /* iPhone 14 / iPhone 14 Pro */
    .logo {
        display: none;
    }
    
    .header-content {
        justify-content: center;
    }
    
    .nav-buttons {
        justify-content: center;
    }
    
    .header {
        padding-top: env(safe-area-inset-top);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .container {
        padding: 0 max(15px, env(safe-area-inset-left)) 0 max(15px, env(safe-area-inset-right));
    }
    
    .chat-container {
        margin: 0.5rem;
        height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 120px);
    }
}

@media only screen 
  and (device-width: 430px) 
  and (device-height: 932px) 
  and (-webkit-device-pixel-ratio: 3) {
    /* iPhone 14 Pro Max */
    .logo {
        display: none;
    }
    
    .header-content {
        justify-content: center;
    }
    
    .nav-buttons {
        justify-content: center;
    }
    
    .header {
        padding-top: env(safe-area-inset-top);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .container {
        padding: 0 max(20px, env(safe-area-inset-left)) 0 max(20px, env(safe-area-inset-right));
    }
    
    .chat-container {
        margin: 0.75rem;
        height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 130px);
    }
    
    .header-content {
        padding: 1rem 0;
    }
}

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .logo {
        display: none;
    }
    
    .header-content {
        justify-content: center;
        padding: 0.75rem 0;
    }
    
    .nav-buttons {
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .nav-buttons .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        min-width: 80px;
    }
    
    .user-info {
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        font-size: 0.8rem;
    }
    
    .user-info .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .hero {
        padding: 2rem 0;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero p {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 2rem;
        padding: 0 10px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
        max-width: 300px;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        font-weight: 600;
        justify-content: center;
        text-align: center;
    }
    
    /* Features Section Mobile */
    section[style*="margin-top: 4rem"] {
        margin-top: 3rem !important;
    }
    
    section[style*="margin-top: 4rem"] > div {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .card {
        margin: 0;
        padding: 1.5rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    /* How It Works Section Mobile */
    section[style*="margin-bottom: 4rem"] {
        margin-top: 3rem !important;
        margin-bottom: 3rem !important;
    }
    
    section[style*="margin-bottom: 4rem"] h2 {
        font-size: 2rem !important;
    }
    
    section[style*="margin-bottom: 4rem"] > div:last-child {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    /* Step circles */
    .text-center div[style*="width: 80px"] {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.5rem !important;
    }
    
    .text-center h3 {
        font-size: 1.2rem;
    }
    
    .chat-container {
        margin: 0.5rem;
        height: calc(100vh - 120px);
        border-radius: 12px;
    }
    
    .chat-header {
        padding: 0.75rem;
    }
    
    .chat-actions-subtle {
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .action-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .chat-input {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .chat-input input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem;
    }
    
    .message {
        max-width: 90%;
        font-size: 0.9rem;
    }
    
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .matchmaking-content {
        padding: 20px 15px;
    }
    
    .search-animation {
        width: 80px;
        height: 80px;
    }
    
    .search-circle {
        width: 80px;
        height: 80px;
    }
    
    /* Notification badge mobile */
    .notification-badge {
        top: -8px;
        right: -8px;
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
        min-width: 14px;
    }
}

/* Mobile Devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    .logo {
        display: none;
    }
    
    .header-content {
        justify-content: center;
        padding: 1rem 0;
    }
    
    .nav-buttons {
        justify-content: center;
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .nav-buttons .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
        min-width: 100px;
    }
    
    .user-info {
        align-items: center;
        gap: 0.5rem;
        font-size: 0.9rem;
    }
    
    .user-info .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .hero {
        padding: 3rem 0;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 2.8rem;
        line-height: 1.2;
        margin-bottom: 1.5rem;
    }
    
    .hero p {
        font-size: 1.1rem;
        line-height: 1.6;
        margin-bottom: 2.5rem;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
        max-width: 400px;
        padding: 1.25rem 2rem;
        font-size: 1.1rem;
        font-weight: 600;
        justify-content: center;
        text-align: center;
    }
    
    /* Features Section */
    section[style*="margin-top: 4rem"] {
        margin-top: 3.5rem !important;
    }
    
    section[style*="margin-top: 4rem"] > div {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem !important;
    }
    
    .card {
        padding: 2rem;
    }
    
    /* How It Works Section */
    section[style*="margin-bottom: 4rem"] {
        margin-top: 3.5rem !important;
        margin-bottom: 3.5rem !important;
    }
    
    section[style*="margin-bottom: 4rem"] h2 {
        font-size: 2.2rem !important;
    }
    
    section[style*="margin-bottom: 4rem"] > div:last-child {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2rem !important;
    }
    
    /* Step circles */
    .text-center div[style*="width: 80px"] {
        width: 70px !important;
        height: 70px !important;
        font-size: 1.8rem !important;
    }
    
    .chat-container {
        margin: 1rem;
        height: calc(100vh - 140px);
    }
    
    .message {
        max-width: 85%;
    }
    
    .nav-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .chat-actions-subtle {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .friends-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .friend-request-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .friend-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Landscape Mobile Phones */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-container {
        height: calc(100vh - 100px);
        margin: 0.5rem;
    }
    
    .header {
        padding: 0.5rem 0;
    }
    
    .header-content {
        flex-direction: row;
        gap: 1rem;
    }
    
    .nav-buttons {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .chat-actions-subtle {
        flex-direction: row;
        padding: 0.5rem 1rem;
        gap: 0.75rem;
    }
    
    .action-btn {
        width: auto;
        flex: 1;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-buttons {
        flex-direction: row;
        gap: 1rem;
        justify-content: center;
    }
    
    .btn {
        max-width: 200px;
    }
    
    .modal-content {
        max-height: 80vh;
    }
    
    .matchmaking-content {
        padding: 20px;
    }
}

/* Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 900px;
        padding: 0 30px;
    }
    
    .chat-container {
        margin: 1.5rem auto;
        max-width: 800px;
        height: calc(100vh - 160px);
    }
    
    .hero h1 {
        font-size: 3rem;
    }
    
    .hero-buttons {
        gap: 1.5rem;
    }
    
    .message {
        max-width: 75%;
    }
    
    .chat-actions-subtle {
        gap: 1rem;
    }
    
    .friends-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .modal-content {
        max-width: 600px;
    }
}

/* Large Screens (1025px+) */
@media (min-width: 1025px) {
    .chat-container {
        margin: 2rem auto;
        max-width: 1000px;
        height: calc(100vh - 180px);
    }
    
    .message {
        max-width: 70%;
    }
    
    .chat-input input:focus {
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }
    
    .action-btn:hover {
        transform: translateY(-1px);
    }
}

/* Ultra-wide screens */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    .chat-container {
        max-width: 1200px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .user-avatar,
    .status-indicator,
    .action-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animated-bg::before {
        animation: none;
    }
}

/* Dark mode preference (for future use) */
@media (prefers-color-scheme: dark) {
    /* Your app already uses dark theme, but this ensures compatibility */
    :root {
        color-scheme: dark;
    }
}

/* Matchmaking Modal Styles */
.matchmaking-modal {
    max-width: 500px;
    width: 90%;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.matchmaking-modal .modal-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
}

.matchmaking-modal .modal-title {
    color: white;
    font-size: 1.8rem;
    margin: 0;
    font-weight: 600;
}

.matchmaking-modal .modal-close {
    color: white;
    opacity: 0.8;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.matchmaking-modal .modal-close:hover {
    opacity: 1;
}

.matchmaking-content {
    padding: 40px 30px;
}

.search-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
}

.search-circle {
    width: 120px;
    height: 120px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: matchSpin 2s linear infinite;
}

.search-dots {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 8px;
}

.search-dots span {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: matchPulse 1.5s ease-in-out infinite;
}

.search-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.search-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes matchSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes matchPulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.match-status h4 {
    font-size: 1.4rem;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.match-status p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0 0 30px 0;
}

.match-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.matchmaking-modal .modal-footer {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.matchmaking-modal .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.matchmaking-modal .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Match found animation */
.match-found {
    animation: matchFound 0.6s ease-out;
}

@keyframes matchFound {
    0% {
        transform: scale(1);
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    50% {
        transform: scale(1.05);
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    }
    100% {
        transform: scale(1);
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    }
} 

/* Friends Page Specific Styles */
.friends-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.search-section {
    display: flex;
    justify-content: center;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 45px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.search-input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.3);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    pointer-events: none;
}

.clear-search {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-results-info {
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1.5rem;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.pagination-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-1px);
}

.pagination-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.3);
}

.pagination-info {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
}

/* Mobile Responsive Styles for Friends */
@media (max-width: 768px) {
    .friends-controls {
        gap: 1rem;
    }
    
    .search-container {
        max-width: none;
    }
    
    .search-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 45px 14px 45px;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .action-buttons .btn {
        flex: 1;
        min-width: 140px;
        max-width: 200px;
    }
    
    .pagination {
        gap: 0.25rem;
    }
    
    .pagination-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
    
    .pagination-info {
        font-size: 0.8rem;
        padding: 0 1rem;
    }
    
    .search-results-info {
        display: block;
        margin-top: 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .friends-controls {
        margin-bottom: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons .btn {
        width: 100%;
        max-width: 280px;
    }
    
    .pagination-btn {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
        padding: 0 8px;
    }
}

/* Landscape Mobile */
@media (max-width: 926px) and (orientation: landscape) {
    .friends-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
    }
    
    .search-section {
        flex: 1;
        max-width: 400px;
    }
    
    .action-buttons {
        flex-shrink: 0;
        gap: 0.5rem;
    }
    
    .action-buttons .btn {
        white-space: nowrap;
        min-width: auto;
        flex: none;
    }
}

/* Desktop and larger screens */
@media (min-width: 1025px) {
    .friends-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .search-section {
        flex: 1;
        max-width: 500px;
    }
    
    .action-buttons {
        flex-shrink: 0;
    }
}

/* Extra Small Mobile Devices (320px and below) */
@media (max-width: 320px) {
    .container {
        padding: 0 10px;
    }
    
    .hero h1 {
        font-size: 1.8rem !important;
    }
    
    .hero p {
        font-size: 0.9rem !important;
        padding: 0 5px !important;
    }
    
    .hero-buttons .btn {
        max-width: 280px !important;
        padding: 0.875rem 1.25rem !important;
        font-size: 0.95rem !important;
    }
    
    .nav-buttons .btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
        min-width: 70px !important;
    }
    
    .card {
        padding: 1.25rem !important;
    }
    
    .text-center div[style*="width: 80px"] {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.25rem !important;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) and (max-height: 500px) {
    .hero {
        padding: 1.5rem 0 !important;
    }
    
    .hero h1 {
        font-size: 2rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .hero p {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .hero-buttons {
        flex-direction: row !important;
        gap: 1rem !important;
        justify-content: center;
    }
    
    .hero-buttons .btn {
        max-width: 200px !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
    }
    
    section[style*="margin-top: 4rem"] {
        margin-top: 2rem !important;
    }
    
    section[style*="margin-bottom: 4rem"] {
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }
}

/* iPhone SE and similar small screens */
@media (max-width: 375px) and (max-height: 667px) {
    .header-content {
        padding: 0.5rem 0 !important;
    }
    
    .hero {
        padding: 1.5rem 0 !important;
    }
    
    .hero h1 {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }
    
    .hero p {
        font-size: 0.95rem !important;
        margin-bottom: 1.75rem !important;
    }
    
    .hero-buttons .btn {
        max-width: 280px !important;
        padding: 1rem 1.25rem !important;
    }
}

/* Hide floating chat badges on friends page */
.floating-friend-unread {
    display: none !important;
}

/* Ensure no stray notification badges appear on friend cards */
.friend-card .notification-badge,
.friend-card .floating-friend-unread,
.friend-actions-vertical .notification-badge {
    display: none !important;
}

/* Additional mobile improvements */
@media (max-width: 768px) {
    /* Better touch targets */
    .btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Prevent text selection on buttons */
    .btn, .nav-buttons, .hero-buttons {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Improve tap highlighting */
    .btn {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    /* Better modal on mobile */
    .modal-content {
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* Improve readability */
    .text-secondary {
        line-height: 1.6;
    }
    
    /* Better spacing for cards */
    .card-header {
        padding-bottom: 1rem;
    }
    
    .card p {
        line-height: 1.6;
    }
}

/* Profile Page Styles */
.text-primary {
    color: var(--primary-color);
}

/* Profile specific responsive design */
@media (max-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .card {
        min-width: unset;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 480px) {
    .profile-title {
        font-size: 2rem !important;
    }
    
    .card form {
        padding: 1rem !important;
    }
    
    .account-info-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .quick-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .quick-actions .btn {
        width: 100%;
        justify-content: center;
    }
}