/* Swipe Interface Styles */

/* Prevent any body scrolling */
html, body {
    overflow: hidden;
    height: 100%;
    position: fixed;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Dark background on desktop */
@media (min-width: 768px) {
    body {
        background: #1a1a1a;
    }
}

.app-container {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    background: #f5f5f5;
    overflow: hidden; /* Prevent any overflow */
}

/* On desktop, constrain to mobile aspect ratio */
@media (min-width: 768px) {
    .app-container {
        top: 50%;
        transform: translate(-50%, -50%);
        height: 95vh;
        width: auto;
        max-width: none;
        aspect-ratio: 390 / 844; /* Force mobile aspect ratio - width calculated from height */
    }
}

/* Card Stack (Top Section) */
.card-stack {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 60px 20px; /* Extra bottom padding for card shadow */
    position: relative;
    min-height: 0;
    overflow: visible; /* Allow shadow to extend beyond */
    background: #f5f5f5;
}

/* Notice text behind cards */
.card-notice {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1;
    pointer-events: none;
    user-select: none;
}

.card-notice-title {
    font-size: 18px;
    font-weight: 700;
    color: #999;
    margin-bottom: 4px;
}

.card-notice-tagline {
    font-size: 18px;
    font-style: italic;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #aaa;
    line-height: 1.4;
}

.profile-card {
    width: calc(100% - 40px);
    max-width: 400px;
    aspect-ratio: 1/1;
    max-height: calc(100% - 40px); /* Never exceed container height, accounting for margin */
    background: white;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    touch-action: none;
    user-select: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: grab;
}

.profile-card:active {
    cursor: grabbing;
}

.profile-card.animating {
    transition: transform 0.5s ease, opacity 0.5s ease;
}

/* Slide-in animation for empty/default card */
/* Animations removed - cards appear instantly in stack */

/* Stack cards behind the front card */
.profile-card[data-index="0"] {
    z-index: 10;
    transform: translate(-50%, -50%) scale(1);
}

.profile-card[data-index="1"] {
    z-index: 9;
    transform: translate(-50%, calc(-50% + 10px)) scale(0.95);
    opacity: 0.9;
}

.profile-card[data-index="2"] {
    z-index: 8;
    transform: translate(-50%, calc(-50% + 20px)) scale(0.90);
    opacity: 0.8;
}

.profile-card[data-index="3"] {
    z-index: 7;
    transform: translate(-50%, calc(-50% + 30px)) scale(0.85);
    opacity: 0.7;
}

.profile-card[data-index]:nth-child(n+5) {
    display: none;
}

/* Match card specific styles */
.match-banner {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 25px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 15;
    letter-spacing: 1px;
    opacity: 0.92;
}

.match-swipe-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.45);
    padding: 10px 25px;
    border-radius: 20px;
    z-index: 15;
    opacity: 0.9;
}

/* Invite card banner */
.invite-banner {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
    color: white;
    padding: 10px 25px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 15;
    letter-spacing: 1px;
    opacity: 0.92;
}

/* Swipe indicators */
.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 80px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 20;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.swipe-indicator.like {
    left: 40px;
    color: #51cf66;
    border: 6px solid #51cf66;
    padding: 10px 30px;
    border-radius: 10px;
    transform: translateY(-50%) rotate(-20deg);
}

.swipe-indicator.nope {
    right: 40px;
    color: #ff6b6b;
    border: 6px solid #ff6b6b;
    padding: 10px 30px;
    border-radius: 10px;
    transform: translateY(-50%) rotate(20deg);
}

.card-selfie {
    width: 100%;
    max-height: 100%; /* Respect card container height */
    aspect-ratio: 1/1;
    object-fit: contain;
    display: block;
    background: #000;
}

/* OLD card-actions - kept for backwards compatibility */
.card-actions {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    gap: 20px;
}

/* NEW: Overlay actions at top of card */
.card-overlay-actions {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

.swipe-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid white;
    font-size: 32px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.swipe-btn.swipe-left {
    background: #ff4444;
    color: white;
}

.swipe-btn.swipe-right {
    background: #4caf50;
    color: white;
}

.swipe-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.swipe-btn:active {
    transform: scale(0.95);
}

/* Card navigation for multiple introductions */
.card-navigation {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 25px;
    z-index: 10;
}

.nav-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    background: white;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover:not(.disabled) {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.intro-counter {
    color: white;
    font-size: 14px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* Legacy styles - backwards compatibility */
.swipe-left,
.swipe-right {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.swipe-left {
    background: #ff4444;
    color: white;
}

.swipe-right {
    background: #4caf50;
    color: white;
}

.swipe-left:hover,
.swipe-right:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Match Detail Card */
/* Match cards inherit from .profile-card base styles */
.match-card {
    /* No overrides needed - uses profile-card positioning */
}

.chat-button {
    margin-top: 20px;
    padding: 12px 40px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-button:hover {
    background: #5568d3;
}

/* Photo Slots (Middle Section) */
.photo-slots {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    background: #f5f5f5;
    border-top: none;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0; /* Never shrink - always maintain size */
    margin-top: -40px; /* Pull up to overlap with card shadow space */
}

.photo-slot {
    flex: 1;
    aspect-ratio: 3/4;
    background: white;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, z-index 0s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    z-index: 1;
    isolation: isolate; /* Create new stacking context */
}

/* Default background images for empty slots - set dynamically by JavaScript */
.photo-slot[data-photo-type="selfie"],
.photo-slot[data-photo-type="interest"] {
    background-size: cover;
    background-position: center;
}

/* Hide background when image is loaded */
.photo-slot .slot-image {
    background: white;
    z-index: 1;
}

.photo-slot:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 2; /* Elevate above other slots when hovering */
}

.slot-number {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    z-index: 2;
}

.slot-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
}

/* Matches Row (Bottom Section) */
.matches-row {
    display: flex;
    gap: 10px;
    padding: 10px 20px 10px 20px;
    background: white;
    overflow-x: auto;
    overflow-y: hidden; /* Prevent vertical scrolling */
    min-height: 80px;
    max-height: 80px; /* Fixed height - never grow */
    height: 80px; /* Enforce exact height */
    align-items: center;
    flex-shrink: 0; /* Never shrink - always maintain size */
    /* Add shadow at bottom to cover any gaps */
    box-shadow: 0 1px 0 0 white;
    position: relative;
    z-index: 10; /* Elevate above photo slot shadows */
}

.match-thumbnail-wrapper {
    position: relative;
    display: inline-block;
}

.match-thumbnail {
    width: 60px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.match-thumbnail:hover {
    transform: scale(1.05);
}

.match-unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    padding: 0 5px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* FAB */
.fab, .chat-fab {
    position: fixed;
    bottom: 64px;
    right: 24px;
    width: 73px;
    height: 73px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    border: none;
    font-size: 31px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover, .chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.chat-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Camera Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #667eea;
    color: white;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}

.camera-view {
    position: relative;
    background: black;
}

.camera-view video {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
}

.camera-controls {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.capture-btn {
    padding: 12px 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.capture-btn:hover {
    background: #5568d3;
}

/* Photo Selector */
.photo-selector {
    padding: 20px;
    background: #f5f5f5;
}

.photo-options {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin-bottom: 15px;
}

.photo-option {
    min-width: 80px;
    height: 107px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s;
}

.photo-option.selected {
    border-color: #667eea;
}

.confirm-btn {
    width: 100%;
    padding: 12px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.confirm-btn:hover {
    background: #45a049;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 60px 30px 5px 30px;
    color: #999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.empty-state h3 {
    margin-bottom: auto;
    margin-top: 0;
    color: #666;
    font-size: 18px;
    font-weight: 600;
    word-wrap: break-word;
    max-width: 90%;
}

.empty-state p {
    line-height: 1.8;
    font-size: 16px;
    color: #999;
    word-wrap: break-word;
    max-width: 90%;
}

.empty-state-columns {
    display: flex;
    gap: 40px;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

.empty-state-columns::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 7px;
    background: #fff;
    transform: translate(-50%, -50%);
}

.empty-state-column {
    flex: 1;
    max-width: 150px;
}

.empty-state-column p {
    text-align: center;
    line-height: 1.6;
    font-size: 15px;
}

/* Processing Animation */
@keyframes pulsate {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
        border: 2px solid rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
        border: 2px solid rgba(102, 126, 234, 1);
    }
}

.photo-slot.processing {
    animation: pulsate 2s ease-in-out infinite;
}

.photo-slot.processing .slot-image {
    opacity: 0.9;
}

/* Placeholder text for empty slots - HIDDEN */
.slot-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Hidden - background images serve as visual guide */
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    pointer-events: none;
}

.slot-placeholder span {
    color: #ccc;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    max-width: 90%;
    word-break: normal;
    overflow-wrap: break-word;
    white-space: normal;
    hyphens: none;
}

/* Hide placeholder when image is shown */
.slot-image[style*="display: block"] ~ .slot-placeholder {
    display: none;
}

/* Bottom action buttons */
.card-bottom-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
    gap: 30px;
    z-index: 10;
}

.action-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.reject-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.accept-btn {
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
}

.reject-btn svg,
.accept-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.reject-btn:hover {
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
}

.accept-btn:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 8px 25px rgba(81, 207, 102, 0.6);
}

.reject-btn:active {
    transform: scale(0.95) rotate(-5deg);
}

.accept-btn:active {
    transform: scale(0.95) rotate(5deg);
}

/* Profile Image Crop Modal */
.circular-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.7) 40%);
}

.crop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #2a2a2a;
    border-bottom: 1px solid #444;
}

.crop-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
}

.delete-profile-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-profile-btn:hover {
    background: #da190b;
}

.crop-upload {
    background: #2196F3;
    color: white;
    cursor: pointer;
}

.crop-upload:hover {
    background: #1976D2;
}

/* Circular matches thumbnails */
.match-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}

/* Match Overlay - Tinder style */
.match-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(to bottom, rgba(240, 245, 250, 0.97) 0%, rgba(230, 238, 246, 0.99) 100%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 20px;
    overflow: hidden; /* Hide any overflow */
}

.match-overlay.show {
    transform: translateY(0);
}

.match-overlay h2 {
    color: #2563eb;
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 20px 0;
    text-align: center;
}

.match-overlay-photos {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.match-overlay-photo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.match-overlay-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 280px;
}

.match-overlay-button {
    padding: 14px 30px;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.match-overlay-button.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    font-weight: 700;
}

.match-overlay-button.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.match-overlay-button.secondary {
    background: transparent;
    color: #1e40af;
    border: 2px solid #3b82f6;
}

.match-overlay-button.secondary:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: #2563eb;
    transform: scale(1.05);
}

