 /* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #faf5ff 0%, #fce7f3 100%);
    color: #1f2937;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #faf5ff 0%, #fce7f3 100%);
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

.sparkles {
    font-size: 4rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Auth Screen */
.auth-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #faf5ff 0%, #fce7f3 100%);
}

.auth-container {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100%;
    max-width: 28rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.logo h1 {
    background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2rem;
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.auth-tab {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: #9333ea;
    color: white;
}

.auth-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #9333ea;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.required {
    color: #ef4444;
}

.auth-error {
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: #fecaca;
}

.auth-switch {
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
}

.link-btn {
    background: none;
    border: none;
    color: #9333ea;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    width: 100%;
    max-width: 42rem;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-actions button {
    flex: 1;
}

.interests-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.interest-tag {
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: #f3f4f6;
    color: #6b7280;
}

.interest-tag.selected {
    background: #9333ea;
    color: white;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    padding: 0;
}

/* Main App */
#main-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1rem;
    flex-shrink: 0;
}

.header-content {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content .logo {
    margin: 0;
}

.header-content .logo h1 {
    font-size: 1.25rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.introvert {
    background: #dbeafe;
    color: #1e40af;
}

.badge.balanced {
    background: #d1fae5;
    color: #065f46;
}

.badge.extrovert {
    background: #fed7aa;
    color: #92400e;
}

.welcome-text {
    font-size: 0.875rem;
    color: #6b7280;
    display: none;
}

@media (min-width: 768px) {
    .welcome-text {
        display: block;
    }
}

/* Main Content */
.app-main {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.view {
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
}

/* Discover View */
.discover-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.profile-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 28rem;
    overflow: hidden;
}

.profile-photo {
    position: relative;
    height: 20rem;
    background: linear-gradient(135deg, #a78bfa 0%, #ec4899 50%, #60a5fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-photo-emoji {
    font-size: 6rem;
}

.profile-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.profile-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    padding: 1.5rem;
    color: white;
}

.profile-info-overlay h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.profile-location {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
}

.profile-content {
    padding: 1.5rem;
}

.profile-section {
    margin-bottom: 1rem;
}

.profile-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.profile-section p {
    color: #6b7280;
    font-size: 0.875rem;
}

.interests-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.interest-tag-display {
    padding: 0.25rem 0.75rem;
    background: #f3e8ff;
    color: #7e22ce;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.swipe-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 1.5rem;
    padding-top: 0;
}

.swipe-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem;
    width: 5rem;
    border: none;
    border-radius: 1rem;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.swipe-btn:hover {
    transform: scale(1.05);
}

.swipe-btn:active {
    transform: scale(0.95);
}

.swipe-btn.pass {
    background: #f3f4f6;
}

.swipe-btn.connect {
    background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
    color: white;
}

.swipe-btn-label {
    font-size: 0.75rem;
    font-weight: 600;
}

.no-profiles {
    text-align: center;
    padding: 2rem;
}

.no-profiles-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Matches View */
.matches-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .matches-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .matches-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.match-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s;
}

.match-card:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.match-photo {
    position: relative;
    height: 10rem;
    background: linear-gradient(135deg, #d8b4fe 0%, #f9a8d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.match-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 600;
}

.match-info {
    padding: 0.75rem;
}

.match-info h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-info p {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Messages View */
.messages-container {
    display: flex;
    height: 100%;
    padding: 0;
}

.chat-list {
    width: 100%;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    background: white;
}

@media (min-width: 768px) {
    .chat-list {
        width: 33.333333%;
    }
}

.chat-list-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.chat-list-header h2 {
    font-size: 1.25rem;
}

.chat-item {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-item:hover {
    background: #f9fafb;
}

.chat-item.active {
    background: #f3e8ff;
}

.chat-avatar {
    position: relative;
    font-size: 2rem;
}

.chat-avatar-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background: #fbbf24;
    border-radius: 9999px;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.chat-name-row h3 {
    font-size: 0.875rem;
    font-weight: 600;
}

.chat-name-row .badge {
    font-size: 0.625rem;
}

.chat-preview {
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
}

.chat-window.mobile-hidden {
    display: none;
}

@media (min-width: 768px) {
    .chat-window.mobile-hidden {
        display: flex;
    }
}

.chat-list.mobile-hidden {
    display: none;
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.chat-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.chat-header {
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-back {
    background: none;
    border: none;
    color: #9333ea;
    font-size: 1rem;
    cursor: pointer;
}

@media (min-width: 768px) {
    .chat-back {
        display: none;
    }
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-info h3 {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-info p {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-saved-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message-group {
    display: flex;
    margin-bottom: 1rem;
}

.message-group.sent {
    justify-content: flex-end;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 75%;
}

.message-bubble {
    position: relative;
    padding: 0.75rem;
    border-radius: 1rem;
    word-wrap: break-word;
}

.message-group.sent .message-bubble {
    background: #9333ea;
    color: white;
}

.message-group.received .message-bubble {
    background: white;
    color: #1f2937;
}

.message-bubble.saved {
    box-shadow: 0 0 0 2px #fbbf24;
}

.message-bubble.fading {
    opacity: 0.6;
}

.message-pin {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: #fbbf24;
    border-radius: 9999px;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.message-timer {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: #ef4444;
    border-radius: 9999px;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    animation: pulse 1s infinite;
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.message-group.sent .message-meta {
    color: rgba(255, 255, 255, 0.7);
}

.message-group.received .message-meta {
    color: #9ca3af;
}

.message-save-btn {
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 1;
}

@media (min-width: 768px) {
    .message-save-btn {
        opacity: 0;
    }

    .message-group:hover .message-save-btn {
        opacity: 1;
    }
}

.message-save-btn.saved {
    background: #fef3c7;
    color: #92400e;
}

.message-save-btn:not(.saved) {
    background: #f3f4f6;
    color: #6b7280;
}

.chat-input-container {
    padding: 0.75rem;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.media-btn {
    padding: 0.5rem;
    border: none;
    background: none;
    color: #9333ea;
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 9999px;
    transition: background 0.2s;
}

.media-btn:hover {
    background: #f3e8ff;
}

.chat-input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    font-size: 0.875rem;
}

.chat-input:focus {
    outline: none;
    border-color: #9333ea;
}

.send-btn {
    padding: 0.5rem 1rem;
    background: #9333ea;
    color: white;
    border: none;
    border-radius: 9999px;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #7e22ce;
}

.chat-input-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Profile View */
.profile-container {
    max-width: 42rem;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.profile-content {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.profile-card-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.profile-avatar {
    font-size: 4rem;
}

.profile-details h3 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.profile-details p {
    color: #6b7280;
}

.ephemeral-info {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.info-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.ephemeral-info h4 {
    font-size: 0.875rem;
    color: #581c87;
    margin-bottom: 0.25rem;
}

.ephemeral-info p {
    font-size: 0.75rem;
    color: #7e22ce;
}

.comm-style-section {
    margin: 1rem 0;
}

.comm-style-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.comm-style-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.comm-style-btn {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: #f3f4f6;
    color: #6b7280;
}

.comm-style-btn.active {
    background: #9333ea;
    color: white;
}

.comm-style-desc {
    font-size: 0.75rem;
    color: #6b7280;
}

.media-prefs {
    margin: 1rem 0;
}

.stats-card {
    margin-top: 1rem;
}

.stats-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    text-align: center;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-item {
    padding: 1rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #9333ea;
}

.stat-value.stat-saved {
    color: #f59e0b;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Bottom Navigation */
.bottom-nav {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 0.5rem;
    display: flex;
    justify-content: space-around;
    flex-shrink: 0;
}

.nav-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
    flex: 1;
}

.nav-btn:hover {
    background: #f3f4f6;
}

.nav-btn.active {
    color: #9333ea;
    background: #f3e8ff;
}

.nav-icon {
    font-size: 1.25rem;
}

.nav-label {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.nav-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: #ef4444;
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    font-weight: 600;
}

/* Responsive */
@media (min-width: 640px) {
    .sparkles {
        font-size: 5rem;
    }

    .profile-photo {
        height: 24rem;
    }

    .profile-photo-emoji {
        font-size: 8rem;
    }
}