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

:root {
    --primary: #e07a5f;
    --primary-dark: #c4644d;
    --secondary: #3d405b;
    --background: #f4f1de;
    --surface: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --success: #81b29a;
    --error: #e07a5f;
    --border: #dfe6e9;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Typography */
h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--secondary);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--secondary);
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--secondary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--background);
}

.btn-full {
    width: 100%;
}

/* Header */
.hero {
    text-align: center;
    padding: 60px 20px;
}

.hero h1 {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
    font-weight: 300;
    letter-spacing: -0.02em;
}

.hero h1 span {
    color: var(--primary);
    font-weight: 600;
}

/* Brand with mirror */
.hero h1.brand {
    font-size: 3.5rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.hero h1.brand .mirror {
    display: inline-block;
    color: var(--primary);
    font-weight: 200;
    margin: 0 0.1em;
    opacity: 0.7;
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-light);
}

.header-small {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--secondary);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.logo .mirror {
    color: var(--primary);
    font-weight: 200;
    margin: 0 0.05em;
    opacity: 0.7;
}

.header-small nav a {
    margin-left: 20px;
    color: var(--secondary);
    text-decoration: none;
}

.header-small nav a:hover {
    color: var(--primary);
}

/* Home Page */
.home-content {
    text-align: center;
}

.intro {
    margin-bottom: 40px;
}

.intro h2 {
    margin-bottom: 15px;
}

.intro p {
    color: var(--text-light);
    max-width: 500px;
    margin: 0 auto;
}

.values {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
}

.value-card {
    background: var(--surface);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.value-card h3 {
    color: var(--primary);
}

.value-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.cta-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Forms */
.auth-content {
    max-width: 400px;
    margin: 0 auto;
}

.auth-form {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.form-group.checkbox input {
    width: auto;
    margin-top: 4px;
}

.form-group.checkbox label {
    margin-bottom: 0;
    font-weight: normal;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
}

.auth-switch a {
    color: var(--primary);
}

.auth-subtitle {
    color: var(--text-light);
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Rules Box */
.rules-box {
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    margin-bottom: 20px;
}

.rules-box h3 {
    color: var(--secondary);
    margin-bottom: 15px;
}

.rules-box ul {
    list-style: none;
    margin-bottom: 15px;
}

.rules-box li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.rules-box li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
}

.rules-note {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
}

/* Profile Page */
.profile-form section {
    background: var(--surface);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.hint {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.photo-slot {
    aspect-ratio: 1;
    background: var(--background);
    border: 2px dashed var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.photo-slot:hover {
    border-color: var(--primary);
    background: #fff;
}

.add-photo {
    font-size: 2rem;
    color: var(--text-light);
}

.prompt-group {
    margin-bottom: 20px;
}

.prompt-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--secondary);
}

.prompt-group textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
}

/* Match Card */
.match-content {
    text-align: center;
}

.match-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 20px;
}

.match-photos {
    width: 100%;
    aspect-ratio: 4/5;
    background: var(--border);
}

.match-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.match-info {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.match-name {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.match-location {
    color: var(--text-light);
}

.match-prompts {
    padding: 20px;
}

.prompt {
    text-align: left;
    margin-bottom: 20px;
}

.prompt:last-child {
    margin-bottom: 0;
}

.prompt-question {
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 5px;
}

.prompt-answer {
    color: var(--text);
}

.match-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

/* Chat */
.chat-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 10px;
}

.message.sent {
    background: var(--primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.received {
    background: var(--surface);
    border-bottom-left-radius: 4px;
}

.message-form {
    display: flex;
    gap: 10px;
    padding: 15px 0;
    border-top: 1px solid var(--border);
}

.message-form input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 24px;
    font-size: 1rem;
}

.message-form input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
}

.modal-content h2 {
    margin-bottom: 10px;
}

.modal-content p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.modal-content textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-bottom: 20px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* No Match State */
.no-match-container {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.no-match-icon {
    color: var(--text-light);
    margin-bottom: 20px;
}

.no-match-container h2 {
    color: var(--secondary);
    margin-bottom: 10px;
}

.no-match-container p {
    color: var(--text-light);
    margin-bottom: 15px;
}

.no-match-container .btn {
    margin-top: 10px;
}

/* Welcome/Notice Messages */
.welcome-message {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
}

.welcome-message p {
    margin: 0;
    font-weight: 500;
}

/* Profile Page Enhancements */
.profile-tip {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 20px;
    font-style: italic;
}

.profile-form section h2 {
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 5px;
}

/* Match Photo Placeholder */
.match-photo-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
    font-weight: 700;
}

/* Success State */
.success-message {
    background: var(--success);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Matches Page */
.matches-content h1 {
    margin-bottom: 20px;
}

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--surface);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.match-item:hover {
    transform: translateX(5px);
}

.match-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.match-avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.match-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.match-item-row .match-item {
    flex: 1;
}

.view-profile-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.view-profile-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.match-item .match-name {
    font-size: 1.1rem;
    font-weight: 500;
}

.no-matches {
    text-align: center;
    padding: 40px 20px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.no-matches p {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-with {
    font-weight: 600;
    color: var(--secondary);
}

.back-btn {
    color: var(--primary);
    text-decoration: none;
    font-size: 1.2rem;
}

.report-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.9rem;
}

.report-btn:hover {
    color: var(--error);
}

/* Photo Section */
.photo-section {
    text-align: center;
    margin-bottom: 30px;
}

.photo-preview {
    width: 200px;
    height: 200px;
    margin: 0 auto 15px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background);
    cursor: pointer;
}

.photo-placeholder span {
    font-size: 3rem;
    color: var(--text-light);
}

.photo-placeholder p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* View Profile Page */
.view-profile-content {
    padding-top: 20px;
}

.profile-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profile-photo-section {
    width: 100%;
    aspect-ratio: 4/5;
    background: var(--border);
}

.profile-photo-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo-placeholder-large {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: white;
    font-weight: 700;
}

.profile-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.profile-header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.profile-location {
    color: var(--text-light);
}

.profile-prompts {
    padding: 20px;
}

.profile-prompts .prompt {
    margin-bottom: 20px;
}

.profile-prompts .prompt:last-child {
    margin-bottom: 0;
}

/* Responsive - Desktop */
@media (min-width: 768px) {
    .values {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    /* Container adjustments */
    .container {
        padding: 15px;
    }

    /* Brand scaling */
    .hero h1.brand {
        font-size: 2.5rem;
    }

    .hero {
        padding: 40px 15px;
    }

    .tagline {
        font-size: 1rem;
    }

    /* Header navigation */
    .header-small {
        padding: 12px 0;
        margin-bottom: 20px;
    }

    .header-small nav {
        display: flex;
        gap: 12px;
    }

    .header-small nav a {
        margin-left: 0;
        font-size: 0.9rem;
        padding: 8px 4px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .logo {
        font-size: 1.1rem;
    }

    /* Touch-friendly buttons */
    .btn {
        padding: 14px 20px;
        min-height: 48px;
    }

    /* View profile button - larger touch target */
    .view-profile-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    /* Match item improvements */
    .match-item {
        padding: 12px;
        gap: 12px;
    }

    .match-avatar, .match-avatar-img {
        width: 45px;
        height: 45px;
    }

    .match-item .match-name {
        font-size: 1rem;
    }

    /* Form row stacking on small screens */
    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Chat improvements */
    .chat-content {
        height: calc(100vh - 100px);
        height: calc(100dvh - 100px);
    }

    .chat-header {
        gap: 8px;
    }

    .chat-avatar, .chat-avatar-placeholder {
        width: 32px;
        height: 32px;
    }

    .chat-with {
        font-size: 0.95rem;
    }

    .back-btn {
        padding: 8px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .report-btn {
        padding: 8px;
        min-height: 44px;
        font-size: 0.85rem;
    }

    .message-form {
        padding: 10px 0;
        gap: 8px;
    }

    .message-form input {
        padding: 12px 16px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .message-form .btn {
        padding: 12px 16px;
        min-width: auto;
    }

    .message {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 0.95rem;
    }

    /* Profile page */
    .photo-preview {
        width: 160px;
        height: 160px;
    }

    .profile-form section {
        padding: 20px;
    }

    .prompt-group textarea {
        min-height: 80px;
    }

    /* View profile */
    .profile-header h1 {
        font-size: 1.5rem;
    }

    .profile-photo-placeholder-large {
        font-size: 4rem;
    }

    /* Match card */
    .match-actions {
        gap: 10px;
        padding: 15px;
    }

    .match-info {
        padding: 15px;
    }

    .match-prompts {
        padding: 15px;
    }

    /* Modal improvements */
    .modal {
        padding: 15px;
        align-items: flex-end;
    }

    .modal-content {
        padding: 20px;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
        overflow-y: auto;
    }

    /* Auth forms */
    .auth-form {
        padding: 20px;
    }

    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom */
    }

    /* Typography adjustments */
    h1 {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    /* CTA buttons stack */
    .cta-buttons {
        flex-direction: column;
        gap: 12px;
    }

    .cta-buttons .btn {
        width: 100%;
    }
}

/* Safe area support for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .container {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }

    .message-form {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .modal-content {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* Prevent text size adjustment on orientation change */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better focus states for accessibility */
input:focus,
textarea:focus,
button:focus,
a:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Hide focus ring for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
