html {
    height: 100%;
}

:root {
    --primary-color: #ff5864;
    --secondary-color: #222;
    --background-color: #1a1a1a;
    --text-color: #f1f1f1;
    --glass-bg: rgba(34, 34, 34, 0.5);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    overscroll-behavior: none;
    height: 100%;
    overflow: hidden;
}

#app {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    position: relative;
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    height: 65px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.nav-item.active {
    opacity: 1;
    color: var(--primary-color);
}

.nav-item svg {
    margin-bottom: 4px;
}

.nav-item span {
    font-size: 12px;
}

/* Auth Form */
#auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--background-color);
    z-index: 3000;
}

.auth-logo {
    max-width: 250px;
    margin-bottom: 20px;
}

.auth-form {
    width: 90%;
    max-width: 340px;
    padding: 30px;
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    text-align: center;
}

.auth-form h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #444;
    background: #333;
    color: var(--text-color);
    font-size: 16px;
}

.auth-form button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-form button:hover {
    background: #e04a55;
}

#auth-toggle {
    margin-top: 20px;
    font-size: 14px;
    cursor: pointer;
}

#auth-toggle span {
    color: var(--primary-color);
    font-weight: bold;
}

#auth-message {
    margin-top: 15px;
    color: var(--primary-color);
    font-size: 14px;
    height: 20px;
}

.hidden {
    display: none !important;
}

/* Swipe Card */
.swipe-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Prevent cards from showing outside bounds during animation */
}

.swipe-card {
    position: absolute;
    width: 90vw;
    height: 70vh;
    max-width: 350px;
    max-height: 580px;
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: flex-end;
    user-select: none; /* Prevent text selection during swipe */
    -webkit-user-select: none;
    pointer-events: initial; /* Re-enable pointer events for JS */
}

.activity-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    z-index: 2;
    background: rgba(0,0,0,0.5);
}

.status-very-active {
    background-color: #4CAF50; /* Green */
}
.status-active {
    background-color: #FFC107; /* Amber */
}
.status-inactive {
    background-color: #f44336; /* Red */
}
.status-unknown {
    background-color: #607D8B; /* Blue Grey */
}


.swipe-card img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    top: 0;
    left: 0;
}

.card-info {
    position: relative;
    width: 100%;
    padding: 20px;
    color: white;
    z-index: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
}

.card-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
}

.card-info p {
    font-size: 16px;
}

.swipe-actions {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 1001;
}

.swipe-actions button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid #444;
    background: var(--secondary-color);
    font-size: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.tagline {
    font-style: italic;
    color: #ccc;
    margin: 5px 0;
}

.card-actions {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 0 20px;
}

.view-profile-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid white;
    border-radius: 20px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.view-profile-btn:hover {
    background: white;
    color: black;
}

/* Page base style */
.page {
    width: 100%;
    height: 100%;
    padding: 20px;
    padding-bottom: 100px; /* Space for nav bar */
    box-sizing: border-box;
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow-y: auto; /* Allow vertical scroll within page */
    position: absolute; /* Take up full space of parent */
    top: 0;
    left: 0;
}

.page.active {
    display: flex; /* Show active page */
}

/* Profile Page */
#profile-page {
    text-align: center;
}

#profile-page h2 {
    margin-bottom: 20px;
    flex-shrink: 0;
}

#profile-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
    text-align: left;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px; /* space for scrollbar */
}

.avatar-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

#avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

#profile-form label[for="avatar-input"] {
    cursor: pointer;
    background: var(--secondary-color);
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #444;
}

#profile-form input[type="text"],
#profile-form textarea {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #444;
    background: #333;
    color: var(--text-color);
    font-size: 16px;
}

#profile-form textarea {
    min-height: 100px;
    resize: vertical;
}

#profile-form button, #logout-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

#logout-btn {
    background: #555;
    margin-top: 20px;
    max-width: 500px;
}

/* Matches Page */
#matches-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 500px;
    margin: 20px auto;
    flex-grow: 1;
    overflow-y: auto;
}

#matches-list.empty {
    min-height: 50vh;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #888;
}

.match-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    border: 1px solid #444;
    cursor: pointer;
}

.match-item img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.match-item h4 {
    font-size: 18px;
}

/* Chat Page */
#chat-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--background-color);
}

#chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: var(--secondary-color);
    border-bottom: 1px solid #444;
}

#chat-header button {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
}

#chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
}

.message.sent {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.received {
    background: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

#chat-input-container {
    padding: 10px;
    background: var(--secondary-color);
    border-top: 1px solid #444;
}

#message-form {
    display: flex;
    gap: 10px;
}

#message-input {
    flex-grow: 1;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid #444;
    background: #333;
    color: var(--text-color);
}

#message-form button {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 0 20px;
    border-radius: 18px;
    cursor: pointer;
    font-weight: bold;
}


/* Modal */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-container.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--secondary-color);
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.modal-content a {
    color: var(--primary-color);
    text-decoration: none;
}

#close-modal-btn {
    margin-top: 20px;
    padding: 10px 20px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    border-radius: 8px;
    cursor: pointer;
}

/* User Profile Page */
#user-profile-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0; /* page class will add its own padding, but this has a custom layout */
}

.page-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--background-color);
    flex-shrink: 0;
}

.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    margin-right: 15px;
    cursor: pointer;
}

.page-header h2 {
    margin: 0;
}

#user-profile-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    color: white;
}

#user-profile-content img {
    width: 100%;
    max-width: 400px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.profile-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    gap: 30px;
    background: var(--background-color);
    position: fixed;
    bottom: 85px; /* Above nav bar (65px + 20px margin) */
    left: 0;
    width: 100%;
    z-index: 100;
    flex-shrink: 0;
}

.action-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.like:hover {
    background-color: #e53935;
    transform: scale(1.1);
}

.action-btn.dislike:hover {
    background-color: #424242;
    transform: scale(1.1);
}

/* Timeline Page */
#timeline-page .page-header {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.create-post-container {
    background: var(--secondary-color);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    flex-shrink: 0;
}

.create-post-container textarea {
    width: 100%;
    min-height: 80px;
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    color: var(--text-color);
    padding: 10px;
    margin-bottom: 10px;
    resize: vertical;
}

.create-post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.create-post-actions button, .create-post-actions select {
    background: #333;
    border: 1px solid #444;
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.create-post-actions button.btn {
    background: var(--primary-color);
    font-weight: bold;
}

#timeline-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-grow: 1;
    overflow-y: auto;
    padding: 5px; /* Room for scrollbar and breathing space */
}

.post-card {
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    border: 1px solid #444;
    overflow: hidden;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
}

.post-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-author {
    font-weight: bold;
}

.post-timestamp {
    font-size: 12px;
    color: #888;
}

.post-content {
    padding: 0 15px 15px 15px;
}

.post-content p {
    margin-bottom: 10px;
}

.post-content img {
    width: 100%;
    border-radius: 8px;
    margin-top: 10px;
}

.post-actions {
    display: flex;
    gap: 20px;
    padding: 10px 15px;
    border-top: 1px solid #444;
}

.post-actions button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-likes {
    padding: 0 15px 15px;
    font-size: 14px;
    font-weight: bold;
    color: #aaa;
}


/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    z-index: 1000;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.3s, top 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    top: 40px;
    pointer-events: all;
}

.toast.hidden {
    display: none;
}