:root {
    --bg-color: #f4f6f8;
    --card-bg: #ffffff;
    --primary: #FF4040; /* Coral Red */
    --primary-gradient: linear-gradient(135deg, #FF4040 0%, #FF6B6B 100%);
    --text-main: #1a1d24;
    --text-muted: #8a8d96;
    --overlay-gradient: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0) 100%);
    --shadow-card: 0 10px 30px -5px rgba(0,0,0,0.1);
    --shadow-btn: 0 5px 15px rgba(0,0,0,0.15);
    
    --like-color: #ff2d55;
    --dislike-color: #c7c7cc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Nunito", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center; /* Force horizontal centering of #app */
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    position: relative;
    /* margin: 0 auto; Removed, handled by body flex */
    background: var(--bg-color); /* Ensure app background covers */
    box-shadow: 0 0 50px rgba(0,0,0,0.05); /* Optional: nice shadow on desktop */
}

/* Header */
.top-bar {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.brand-text {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 1px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.filter-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.filter-btn:active {
    background: rgba(255,255,255,0.2);
}

/* Main Card Area */
#card-container {
    flex: 1;
    position: relative;
    margin: 10px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#cards-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--card-bg);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transform-origin: 50% 100%;
    will-change: transform, opacity;
    user-select: none;
}

.card-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
    transition: background-image 0.3s ease;
}

/* Photo Navigation */
.photo-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70%; /* Leave bottom for content */
    z-index: 5;
    display: flex;
}

.photo-nav-left, .photo-nav-right {
    flex: 1;
    height: 100%;
}

.photo-indicators {
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 6;
    padding: 0 10px;
}

.photo-indicator {
    height: 4px;
    flex: 1;
    max-width: 40px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    transition: background 0.2s;
}

.photo-indicator.active {
    background: #ffffff;
}

.card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: var(--overlay-gradient);
}

.card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 24px;
    z-index: 2;
    color: white; /* Force white text on card overlay */
}

.card-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 12px;
}

.card-name {
    font-size: 28px;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.card-age {
    font-size: 22px;
    font-weight: 400;
    opacity: 0.9;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tag-badge {
    background: #2c2c2e; /* Solid dark color */
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 13px; /* Slightly smaller to fit 3 */
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    white-space: nowrap; /* Prevent breaking inside badge */
}

.tag-badge i {
    color: #ffffff;
}

.card-tags {
    display: flex;
    flex-wrap: wrap; /* allow wrapping if still too large, but tight fitting */
    gap: 6px;
    margin-bottom: 12px;
}

.card-report-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    z-index: 20;
    transition: background 0.2s;
}

.card-report-btn:active {
    background: rgba(0,0,0,0.6);
}

.card-bio {
    font-size: 15px;
    line-height: 1.5;
    color: rgba(255,255,255,0.85);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card-bio.expanded {
    -webkit-line-clamp: unset;
    overflow-y: auto;
    max-height: 150px;
    background: rgba(0,0,0,0.3);
    padding: 5px;
    border-radius: 8px;
}

/* Status Stamps */
.stamp {
    position: absolute;
    top: 40px;
    opacity: 0;
    z-index: 10;
    transform: rotate(-15deg);
    pointer-events: none; /* Ensure clicks pass through */
}

.stamp i {
    font-size: 140px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.4);
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
}

.stamp i {
    font-size: 140px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.stamp-like i {
    color: var(--like-color);
}

.stamp-nope i {
    color: #ff3b30;
}

.stamp-like {
    right: 40px;
    transform: rotate(15deg);
}

.stamp-nope {
    left: 40px;
}

/* Controls */
.controls {
    height: 110px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    padding-bottom: 25px;
}

.action-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    margin: 0 10px;
}

.action-btn i {
    font-size: 32px;
    transition: transform 0.2s;
}

.action-btn:active {
    transform: scale(0.9) translateY(2px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.like-btn {
    background: #ffffff;
    width: 80px;
    height: 80px;
}

.like-btn i {
    font-size: 42px;
    color: var(--like-color);
    filter: drop-shadow(0 4px 6px rgba(255, 45, 85, 0.25));
}

.dislike-btn {
    background: #ffffff;
    width: 80px;
    height: 80px;
}

.dislike-btn i {
    font-size: 42px;
    color: var(--dislike-color);
    transition: color 0.2s;
}

.dislike-btn:hover i {
    color: #ff3b30;
}

.report-btn {
    width: 44px;
    height: 44px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: none;
    margin: 0; /* Reset */
}

.report-btn i {
    font-size: 18px;
    color: #c7c7cc; /* Muted color */
}

.report-btn:active {
     background: #f2f2f7;
}

/* Empty State */
.empty-state {
    position: absolute; /* Fix position to avoid flow issues */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: fadeIn 0.5s ease;
    z-index: 5; /* Ensure it's above background but below modals */
}

.empty-icon {
    color: #3a3f4b;
    margin-bottom: 20px;
    /* align-self: center; Removed redundant property */
}

.refresh-btn {
    margin-top: 24px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 64, 64, 0.3);
    width: auto;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: flex-end;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #1e2128;
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    z-index: 1001;
    animation: slideUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.filter-section {
    margin-bottom: 24px;
}

.filter-section label {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.range-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.input-dark {
    flex: 1;
    background: #131519;
    border: 1px solid #2a2e38;
    padding: 14px;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    text-align: center;
    outline: none;
}

.input-dark:focus {
    border-color: var(--primary);
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: #2a2e38;
    border: 1px solid transparent;
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 100px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag.selected {
    background: rgba(255, 60, 47, 0.15);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.apply-btn {
    width: 100%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
}

/* Animations */
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.liker-badge {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 64, 64, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    z-index: 5;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    backdrop-filter: blur(4px);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
    100% { transform: translateX(-50%) scale(1); }
}

.card-reviews {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.review-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rank-badge {
    position: relative;
    padding-left: 48px !important;
    overflow: visible;
    border: 1px solid rgba(255,255,255,0.2);
}

.rank-icon {
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-right: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.report-btn {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin: 0 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-btn);
}

.report-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.6;
}

.report-btn:active {
    transform: scale(0.9);
    background: #f0f0f0;
}

