/* ========================================
   SOCIALMEET CSS - FIXED VERSION
   ======================================== */

:root {
    --primary-cyan: #06b6d4;
    --primary-blue: #3b82f6;
    --dark-bg: #0a0a0f;
    --dark-card: #1a1a24;
    --dark-border: #2a2a3a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(ellipse at top, #1a1a2e 0%, #0a0a0f 50%, #000 100%);
    min-height: 100vh;
    color: white;
}

/* Desktop centering */
@media (min-width: 640px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
    }
}

/* App Container */
#app-container {
    width: 100%;
    height: 100vh;
    max-width: 100%;
    position: relative;
    background: linear-gradient(135deg, rgba(15, 15, 26, 0.95), rgba(26, 26, 46, 0.9));
    border: 1px solid rgba(59, 130, 246, 0.15);
}

@media (min-width: 640px) {
    #app-container {
        width: 430px;
        height: 90vh;
        max-height: 900px;
        border-radius: 28px;
        box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 48px rgba(6, 182, 212, 0.2);
    }
}

/* Pages */
.page {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 80px;
    overflow: hidden;
}

.page.active {
    display: block;
}

/* Home Page */
#page-home {
    padding: 2rem;
    text-align: center;
}

#page-home.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#page-home svg {
    width: 6rem;
    height: 6rem;
    color: #22d3ee;
    filter: drop-shadow(0 0 24px currentColor);
}

#page-home h1 {
    font-size: 3.75rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
}

#page-home p {
    font-size: 1.125rem;
    color: #9ca3af;
    margin-bottom: 2rem;
}

#page-home button {
    width: 100%;
    margin-bottom: 1rem;
}

#user-id-display {
    font-size: 0.75rem;
    color: #6b7280;
    word-break: break-all;
    font-family: monospace;
    margin-top: 2rem;
}

/* Swiper Page */
#page-swipe {
    display: none;
}

#page-swipe.active {
    display: block;
}

/* Swiper Header */
#page-swipe > div:first-child {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(10, 10, 15, 0.9), transparent);
    z-index: 20;
}

#page-swipe > div:first-child h1 {
    font-size: 1.25rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#page-swipe > div:first-child button {
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

#page-swipe > div:first-child svg {
    width: 1.75rem;
    height: 1.75rem;
}

/* Card Stack */
.card-stack {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    perspective: 1200px;
}

.profile-card {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 16px;
    right: 16px;
    background: linear-gradient(135deg, var(--dark-card), #0f0f1a);
    border-radius: 28px;
    border: 1px solid var(--dark-border);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.profile-card.dragging {
    cursor: grabbing;
}

.card-image-container {
    width: 100%;
    height: 75%;
    background-size: cover;
    background-position: center;
    position: relative;
}

.card-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: linear-gradient(to top, rgba(10, 10, 15, 0.98) 0%, rgba(10, 10, 15, 0.8) 40%, transparent 100%);
}

.pagination-dots {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.pagination-dots .dot {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

.pagination-dots .dot.active {
    background: linear-gradient(90deg, var(--primary-cyan), var(--primary-blue));
}

.card-image-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 9;
}

.card-image-nav.left { left: 0; }
.card-image-nav.right { right: 0; }

/* Profile Info */
.profile-card > div:last-child {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    z-index: 10;
}

.profile-card h2 {
    font-size: 1.875rem;
    font-weight: 900;
    color: white;
    margin-bottom: 0.5rem;
}

.profile-card .flex {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #d1d5db;
    font-size: 0.875rem;
}

.profile-card svg {
    width: 1rem;
    height: 1rem;
}

/* Choice Overlays */
.choice-overlay {
    position: absolute;
    top: 60px;
    font-size: 3.5rem;
    font-weight: 900;
    padding: 1rem 2rem;
    border-radius: 20px;
    opacity: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
}

.choice-overlay.like {
    color: var(--success);
    border: 5px solid var(--success);
    background: rgba(16, 185, 129, 0.2);
    transform: rotate(-20deg);
    right: 30px;
}

.choice-overlay.nope {
    color: var(--danger);
    border: 5px solid var(--danger);
    background: rgba(239, 68, 68, 0.2);
    transform: rotate(20deg);
    left: 30px;
}

/* Action Buttons Container */
#page-swipe > div:last-child {
    position: absolute;
    bottom: 80px;
    left: 0;
    right: 0;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    z-index: 20;
}

.action-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: transform 0.3s;
}

.action-btn:hover {
    transform: scale(1.15);
}

.action-btn svg {
    width: 2.5rem;
    height: 2.5rem;
}

.btn-nope {
    background: linear-gradient(135deg, #1f2937, #374151);
    color: var(--danger);
}

.btn-like {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-gem {
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
    color: white;
    width: 80px;
    height: 80px;
    position: relative;
}

#gem-counter {
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    color: var(--primary-cyan);
    font-size: 0.875rem;
    font-weight: bold;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-cyan);
}

/* Chats Page */
#page-chats {
    padding: 1.5rem;
    overflow-y: auto;
    padding-bottom: 96px;
}

#page-chats h1 {
    font-size: 1.875rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 24px currentColor;
}

#chats-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#no-chats-message {
    color: #6b7280;
    text-align: center;
    padding: 2rem 0;
}

.chat-item {
    background: linear-gradient(135deg, var(--dark-card), #0f0f1a);
    border: 1px solid var(--dark-border);
    border-radius: 20px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    position: relative;
}

.chat-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.chat-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
}

.presence-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid var(--dark-card);
}

.presence-indicator.online {
    background: var(--success);
}

.presence-indicator.offline {
    background: #6b7280;
}

.favorite-star {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 20px;
    cursor: pointer;
}

/* Tab Bar */
#tab-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    border-top: 1px solid var(--dark-border);
    background: linear-gradient(180deg, rgba(10, 10, 15, 0.98), rgba(26, 26, 36, 0.99));
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 50;
}

@media (min-width: 640px) {
    #tab-bar {
        border-radius: 0 0 28px 28px;
    }
}

.tab-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 20px;
    background: none;
    border: none;
}

.tab-button.active {
    color: var(--primary-cyan);
}

.tab-button svg {
    width: 28px;
    height: 28px;
    margin-bottom: 6px;
}

/* Chat Detail */
#page-chat-detail {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateX(100%);
    width: 100%;
    max-width: 430px;
    height: 90vh;
    max-height: 900px;
    background: linear-gradient(135deg, #0f0f1a, #1a1a2e);
    border: 1px solid rgba(59, 130, 246, 0.15);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    z-index: 100;
    transition: transform 0.3s, opacity 0.3s;
    display: flex;
    flex-direction: column;
    border-radius: 28px;
    opacity: 0;
    pointer-events: none;
}

#page-chat-detail.visible {
    transform: translate(-50%, -50%);
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 639px) {
    #page-chat-detail {
        top: 0;
        left: 0;
        transform: translateX(100%);
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        background: #0a0a0f;
    }

    #page-chat-detail.visible {
        transform: translateX(0);
    }
}

.chat-header {
    background: linear-gradient(135deg, var(--dark-card), #0f0f1a);
    border-bottom: 1px solid var(--dark-border);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header button {
    background: none;
    border: none;
    color: var(--primary-cyan);
    cursor: pointer;
}

#chat-message-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.75rem;
}

.message-bubble {
    max-width: 75%;
    padding: 0.875rem 1.125rem;
    border-radius: 20px;
    word-wrap: break-word;
}

.message-bubble.sent {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    color: white;
    align-self: flex-end;
}

.message-bubble.received {
    background: var(--dark-card);
    color: white;
    align-self: flex-start;
    border: 1px solid var(--dark-border);
}

.message-bubble.system {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
    align-self: center;
    text-align: center;
    border: 1px solid #a855f7;
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--dark-border);
    display: flex;
    gap: 0.75rem;
}

#chat-input {
    flex: 1;
    background: var(--dark-bg);
    color: white;
    border: 1px solid var(--dark-border);
    border-radius: 28px;
    padding: 0.875rem 1.25rem;
    outline: none;
}

#btn-chat-send {
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
    color: white;
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: linear-gradient(135deg, var(--dark-card), #0f0f1a);
    border: 1px solid var(--dark-border);
    border-radius: 28px;
    padding: 2rem;
    width: 90%;
    max-width: 420px;
}

.modal-content h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

.modal-content label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.modal-content select,
.modal-content input[type="text"],
.modal-content input[type="number"] {
    width: 100%;
    background: var(--dark-bg);
    color: white;
    border: 1px solid var(--dark-border);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.modal-content input[type="range"] {
    width: 100%;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
    color: white;
    font-weight: 700;
    padding: 1rem 1.75rem;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    width: 100%;
}

.btn-secondary {
    background: var(--dark-card);
    color: white;
    font-weight: 600;
    padding: 1rem 1.75rem;
    border-radius: 20px;
    border: 1px solid var(--dark-border);
    cursor: pointer;
    width: 100%;
}

/* Loading */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--dark-bg);
    z-index: 999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 72px;
    height: 72px;
    border: 5px solid var(--dark-border);
    border-top-color: var(--primary-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-7 { width: 1.75rem; }
.h-7 { height: 1.75rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.text-lg { font-size: 1.125rem; }
.font-bold { font-weight: 700; }
.text-white { color: white; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-sm { font-size: 0.875rem; }
.capitalize { text-transform: capitalize; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.absolute { position: absolute; }
.relative { position: relative; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.z-10 { z-index: 10; }
.mb-2 { margin-bottom: 0.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-black { font-weight: 900; }

.bg-gradient-to-br { background-image: linear-gradient(to bottom right, var(--tw-gradient-stops)); }
.from-cyan-400 { --tw-gradient-from: #22d3ee; }
.to-blue-500 { --tw-gradient-to: #3b82f6; }
.from-purple-400 { --tw-gradient-from: #c084fc; }
.to-pink-500 { --tw-gradient-to: #ec4899; }
.from-green-400 { --tw-gradient-from: #4ade80; }
.to-emerald-500 { --tw-gradient-to: #10b981; }
.from-orange-400 { --tw-gradient-from: #fb923c; }
.to-red-500 { --tw-gradient-to: #ef4444; }
.from-blue-400 { --tw-gradient-from: #60a5fa; }
.to-indigo-500 { --tw-gradient-to: #6366f1; }
