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

:root {
    /* Modern Craft Design System */
    --primary-color: #f59e0b;          /* Golden Amber */
    --primary-hover: #d97706;          /* Deep Amber */
    --secondary-color: #1f2937;        /* Charcoal */
    --success-color: #10b981;          /* Fresh Hop */
    --warning-color: #f59e0b;          /* Golden Amber */
    --error-color: #ef4444;            /* Warm Red */
    --text-dark: #1f2937;              /* Charcoal for headings */
    --text-body: #4b5563;              /* Slate Grey for body text */
    --text-light: #6b7280;             /* Muted grey */
    --border-color: #e5e7eb;           /* Light border */
    --background: #f9fafb;             /* Foam White - main background */
    --surface: #ffffff;                /* Pure White - cards, modals */
    --white: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-body);
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 70px; /* Account for fixed unified navbar */
}

/* Navigation Bar */
.navbar {
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-brand:hover {
    color: var(--primary-hover);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-user {
    color: var(--text-light);
    font-size: 0.95rem;
}

.nav-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s;
}

.nav-link:hover {
    background: var(--background);
    color: var(--primary-color);
}

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

.nav-link-primary:hover {
    background: var(--primary-hover);
    color: var(--white);
}

.nav-link-logout {
    color: var(--error-color);
}

/* Messages Container */
.messages-container {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 2rem;
}

.message {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.message-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.message-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--error-color);
}

.message-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.message-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Auth Container */
.auth-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.auth-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 2.5rem;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-card {
    max-width: 700px;
}

.auth-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle {
    color: var(--text-light);
    text-align: center;
    margin-bottom: 2rem;
}

/* Profile Header */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 12px;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.profile-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
}

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

.profile-display-name {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 999px; /* Pill shape */
    font-size: 0.875rem;
    font-weight: 500;
}

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

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

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

.form-section {
    margin-bottom: 2rem;
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    font-family: inherit;
    background: var(--surface);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.form-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-group-checkbox label {
    margin-bottom: 0;
    cursor: pointer;
}

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

.checkbox-label a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.help-text {
    display: block;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.form-errors,
.field-errors {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fee2e2;
    border-radius: 0.375rem;
}

.field-errors ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.current-avatar {
    margin-bottom: 1rem;
}

.current-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 0.5rem;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.current-avatar p {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

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

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--text-body);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--text-light);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-actions .btn {
    flex: 1;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    color: var(--text-light);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Profile Stats */
.profile-stats {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: 12px;
}

.profile-stats h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.profile-stats ul {
    list-style: none;
}

.profile-stats li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-stats li:last-child {
    border-bottom: none;
}

/* Footer */
.footer {
    background: var(--surface);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .form-actions {
        flex-direction: column;
    }

    body {
        padding-top: calc(76px + env(safe-area-inset-top, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}
