/*
 * Kind Connector Styles
 * Design principles: Calm before clever, Legibility over density, Warmth over sterility
 */

/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ========================================
   RESET & BASE
   ======================================== */

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

:root {
    /* Color palette */
    --bg-warm: #FAF9F7;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #888;
    --accent: #2563eb; /* strong blue for buttons */
    --accent-hover: #1d4ed8;
    --border: #E8E6E1;
    --surface: #FFFFFF;
    --surface-soft: #F7F6F3;

    /* Success/error states - muted */
    --success-bg: #EDF7F0;
    --success-text: #2F5940;
    --error-bg: #FDF2F2;
    --error-text: #7C3434;

    /* Spacing system (8px base) */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 32px;
    --space-xl: 48px;
    --space-xxl: 64px;

    /* Typography - inspired by Ready */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;
    --line-height-relaxed: 1.65;

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--text-primary);
    background: linear-gradient(180deg, #FAF9F7 0%, #F5F0E8 30%, #E8E4DC 70%, #a6c0e7 100%);
    min-height: 100vh;
    padding: var(--space-md);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Subtle organic decorative elements */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    right: -5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(111, 143, 122, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -15%;
    left: -8%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(111, 143, 122, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
}

/* ========================================
   LAYOUT
   ======================================== */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-md);
    position: relative;
    z-index: 1;
}

/* Generous outer margins at all breakpoints */
@media (min-width: 768px) {
    body {
        padding: var(--space-xl);
    }

    .container {
        padding: 0 var(--space-lg);
    }
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

h1 {
    font-size: 2.2em;
    margin-bottom: var(--space-md);
}

h2 {
    font-size: 1.6em;
}

h3 {
    font-size: 1.3em;
    color: var(--text-primary);
}

h4 {
    font-size: 1.1em;
}

p {
    margin-bottom: var(--space-sm);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.7;
}

/* ========================================
   HEADER
   ======================================== */

header {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: var(--space-xxl);
    padding: var(--space-xl) var(--space-lg);
}

header h1 {
    font-size: 3em;
    margin-bottom: var(--space-md);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.tagline {
    font-size: 1.2em;
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
}

/* ========================================
   SCREENS & VIEWS
   ======================================== */

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hidden {
    display: none;
}

/* ========================================
   CONTENT BOXES
   ======================================== */

.auth-box,
.content-box {
    background: var(--surface);
    border-radius: 20px;
    padding: var(--space-xl);
    box-shadow: 0 8px 40px rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.05);
    max-width: 500px;
    margin: 0 auto var(--space-lg) auto;
    border: 1px solid rgba(0,0,0,0.06);
}

.content-box {
    max-width: 700px;
}

.content-box.wide {
    max-width: 900px;
}

/* ========================================
   FORMS
   ======================================== */

label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95em;
}

/* Plain language, never demanding */
.form-intro {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: var(--line-height-relaxed);
}

.form-section {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: var(--accent);
    margin-bottom: var(--space-md);
    font-size: 1.2em;
    font-weight: 600;
}

.form-note,
.privacy-note {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: var(--space-xs);
    line-height: var(--line-height-relaxed);
}

.form-note {
    margin-bottom: var(--space-sm);
}

/* Helper text: used generously to reassure */
.helper-text {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: var(--space-xs);
}

/* ========================================
   FORM INPUTS
   ======================================== */

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
    width: 100%;
    padding: 14px var(--space-sm);
    margin-bottom: var(--space-sm);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1em;
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(111, 143, 122, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: var(--line-height-relaxed);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Placeholder styling */
::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Checkbox styling */
.checkbox-field {
    margin-top: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.checkbox-field input[type="checkbox"] {
    width: auto;
    margin: 0;
    margin-right: var(--space-xs);
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    bottom: 1px;
    min-width: 18px;
    min-height: 18px;
}

.checkbox-field label {
    display: inline;
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    vertical-align: middle;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-block;
    padding: 14px var(--space-lg);
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 44px; /* Accessibility: tap target size */
    letter-spacing: -0.01em;
}

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

.btn-primary {
    background: var(--accent);
    color: var(--surface);
    width: 100%;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(111, 143, 122, 0.05);
}

.btn-small {
    width: auto;
    padding: 10px 20px;
    font-size: 0.9em;
}

.btn-large {
    padding: 16px var(--space-xl);
    font-size: 1.05em;
}

.btn-danger {
    background: #C17070;
    color: var(--surface);
}

.btn-danger:hover:not(:disabled) {
    background: #A85D5D;
}

#ask-for-help-btn {
    background: var(--accent);
    padding: 12px var(--space-md);
    font-size: 0.95em;
    width: 200px;
    float: right;
    margin-bottom: var(--space-md);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #FC6A03;
}

#ask-for-help-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
    transform: translateY(-2px);
    background-color: #BE5504;    
}

/* ========================================
   NAVIGATION
   ======================================== */

.app-nav {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    background: var(--surface);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.nav-btn {
    flex: 1;
    padding: 12px var(--space-sm);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95em;
}

.nav-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--text-primary);
    color: var(--surface);
    border-color: var(--text-primary);
}

.nav-btn.logout {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
    flex: 0 0 auto;
}

.nav-btn.logout:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* ========================================
   MESSAGES
   ======================================== */

.message {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    text-align: center;
    display: none;
    line-height: var(--line-height-relaxed);
}

.message.success {
    background: var(--success-bg);
    color: var(--success-text);
    display: block;
    border-left: 3px solid var(--accent);
}

.message.error {
    background: var(--error-bg);
    color: var(--error-text);
    display: block;
    border-left: 3px solid #C17070;
}

/* ========================================
   AUTH SCREENS
   ======================================== */

.auth-switch {
    text-align: center;
    margin-top: var(--space-md);
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--accent);
    font-weight: 500;
}

.divider {
    text-align: center;
    margin: var(--space-lg) 0;
    color: var(--text-muted);
    font-weight: 500;
    position: relative;
    font-size: 0.9em;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

/* ========================================
   MAIN SCREEN & VIEWS
   ======================================== */

#main-screen .view {
    background: var(--surface);
    border-radius: 20px;
    padding: var(--space-xl);
    box-shadow: 0 8px 40px rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.06);
}

/* ========================================
   SEARCH
   ======================================== */

.search-box {
    margin-bottom: var(--space-lg);
    width: 100%;
}

.search-box input {
    width: 100%;
    padding: 14px var(--space-md);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1em;
    background: var(--surface-soft);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
}

/* ========================================
   BROWSE CONTROLS
   ======================================== */

.browse-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    gap: var(--space-md);
}

.view-toggle {
    display: flex;
    gap: var(--space-xs);
    background: var(--surface-soft);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.view-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.view-btn:hover {
    background: var(--surface);
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--accent);
    color: var(--surface);
}

/* ========================================
   MEMBER CARDS
   ======================================== */

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-md);
}

.member-card {
    background: var(--surface);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 20px;
    padding: var(--space-lg);
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.member-card:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    transform: translateY(-4px);
    border-color: rgba(0,0,0,0.1);
}

.member-card h3 {
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    font-size: 1.2em;
}

.member-card .location {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: var(--space-sm);
}

.member-card .section {
    margin-bottom: var(--space-sm);
}

.member-card .section-title {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.member-card .section-content {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: var(--line-height-relaxed);
}

.member-card .bio {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-style: italic;
    line-height: var(--line-height-relaxed);
}

.member-card .contact-section {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.member-card .contact-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
    font-size: 0.9em;
    color: var(--text-secondary);
}

.member-card .contact-item a {
    color: var(--accent);
}

.member-card.current-user {
    border: 2px solid var(--accent);
    background: var(--surface-soft);
}

.member-card .tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
}

.member-card .skill-tag,
.member-card .resource-tag {
    background: rgba(111, 143, 122, 0.15);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 500;
}

.member-card .resource-tag {
    background: rgba(111, 143, 122, 0.1);
    color: #5d7766;
}

/* ========================================
   TABLE VIEW
   ======================================== */

.members-table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.members-table {
    width: 100%;
    border-collapse: collapse;
}

.members-table thead {
    background: var(--surface-soft);
}

.members-table th {
    padding: var(--space-md);
    text-align: left;
    font-weight: 600;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.members-table th:hover {
    background: rgba(111, 143, 122, 0.05);
}

.members-table th.sortable::after {
    content: ' ⇅';
    opacity: 0.3;
    font-size: 0.9em;
}

.members-table th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
}

.members-table th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
}

.members-table td {
    padding: var(--space-md);
    border-bottom: 1px solid rgba(232, 230, 225, 0.5);
    vertical-align: top;
    color: var(--text-secondary);
}

.members-table tr.member-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.members-table tr.member-row:hover {
    background: var(--surface-soft);
}

.members-table tr:last-child td {
    border-bottom: none;
}

.table-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 300px;
}

.table-tag {
    display: inline-block;
    background: rgba(111, 143, 122, 0.12);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    white-space: nowrap;
}

.table-contact {
    font-size: 0.9em;
    color: var(--text-secondary);
}

.table-contact a {
    color: var(--accent);
}

.table-location {
    color: var(--text-muted);
    font-size: 0.9em;
}

.table-empty {
    padding: var(--space-xxl);
    text-align: center;
    color: var(--text-muted);
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-xxl);
    font-size: 1em;
}

/* ========================================
   TAG INPUT COMPONENT
   ======================================== */

.tag-input-wrapper {
    margin-top: var(--space-sm);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
    min-height: 40px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: var(--accent);
    color: var(--surface);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

.tag-remove {
    background: none;
    border: none;
    color: var(--surface);
    font-size: 1.2em;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    width: auto;
    transition: opacity 0.2s ease;
}

.tag-remove:hover {
    opacity: 0.7;
}

.tag-input-field {
    position: relative;
    display: flex;
    gap: var(--space-sm);
}

.tag-search-input {
    flex: 1;
    padding: 12px var(--space-sm);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1em;
}

.tag-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.browse-tags-btn {
    padding: 12px var(--space-md);
    background: var(--accent);
    color: var(--surface);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.browse-tags-btn:hover {
    background: var(--accent-hover);
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1.5px solid var(--accent);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.tag-suggestions.hidden {
    display: none;
}

.tag-suggestion-item {
    padding: 12px var(--space-sm);
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(232, 230, 225, 0.5);
}

.tag-suggestion-item:last-child {
    border-bottom: none;
}

.tag-suggestion-item:hover {
    background: rgba(111, 143, 122, 0.08);
}

.tag-categories {
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-md);
}

.tag-category {
    margin-bottom: var(--space-md);
}

.category-title {
    color: var(--accent);
    font-size: 1em;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid rgba(111, 143, 122, 0.2);
}

.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tag-pill {
    background: var(--surface-soft);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tag-pill:hover {
    background: var(--accent);
    color: var(--surface);
    border-color: var(--accent);
}

.tag-badge {
    display: inline-block;
    background: rgba(111, 143, 122, 0.12);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 0.85em;
    margin: 3px;
    font-weight: 500;
}

.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

/* ========================================
   INFO BOXES
   ======================================== */

.info-box {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.info-box h3 {
    color: var(--accent);
    margin-bottom: var(--space-sm);
}

.info-box p {
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    line-height: var(--line-height-relaxed);
}

.invite-code-display {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-top: var(--space-md);
}

.invite-code-display code {
    flex: 1;
    background: var(--surface);
    padding: var(--space-md);
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 1.2em;
    font-weight: 600;
    color: var(--accent);
    text-align: center;
    letter-spacing: 2px;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

#invite-section {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.contact-info,
.address-info {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--surface-soft);
    border-radius: var(--radius-sm);
    line-height: var(--line-height-relaxed);
}

.contact-info a {
    color: var(--accent);
}

.contact-info em {
    font-style: normal;
    color: var(--text-muted);
    font-size: 0.9em;
}

.address-info {
    background: rgba(255, 243, 224, 0.5);
    border-left: 3px solid #D4A574;
}

/* ========================================
   NETWORK CARDS
   ======================================== */

.networks-list {
    margin-top: var(--space-md);
    display: grid;
    gap: var(--space-md);
}

.network-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: box-shadow 0.2s ease;
}

.network-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.network-card h4 {
    margin: 0 0 var(--space-sm) 0;
    color: var(--text-primary);
    font-size: 1.2em;
}

.network-card p {
    margin: 0 0 var(--space-md) 0;
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: var(--line-height-relaxed);
}

.network-card .network-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.network-card .network-meta span {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* ========================================
   MODAL
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(46, 46, 46, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--surface);
    margin: var(--space-md);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

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

.close-modal,
.close-profile-modal,
.close-create-modal,
.close-help-modal {
    color: var(--text-muted);
    position: absolute;
    right: var(--space-md);
    top: var(--space-md);
    font-size: 28px;
    font-weight: normal;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus,
.close-profile-modal:hover,
.close-profile-modal:focus,
.close-create-modal:hover,
.close-create-modal:focus,
.close-help-modal:hover,
.close-help-modal:focus {
    color: var(--text-primary);
}

.network-name-display {
    color: var(--accent);
    font-weight: 500;
    font-size: 1.1em;
    margin-bottom: var(--space-md);
}

.modal-content .form-section {
    margin-bottom: var(--space-md);
    padding-bottom: 0;
    border-bottom: none;
}

.modal-content .form-section label {
    display: block;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95em;
}

/* ========================================
   DANGER ZONE
   ======================================== */

.danger-zone {
    margin-top: var(--space-xl);
    padding: var(--space-md);
    background: rgba(252, 242, 242, 0.5);
    border: 1.5px solid #E5C5C5;
    border-radius: var(--radius-md);
}

.danger-zone h3 {
    color: #C17070;
    margin-bottom: var(--space-sm);
    font-size: 1.1em;
}

.danger-zone p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    line-height: var(--line-height-relaxed);
}

/* ========================================
   FILTER SECTION
   ======================================== */

.filter-section {
    background: var(--surface);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.filter-section h3 {
    color: var(--accent);
    margin-bottom: var(--space-sm);
}

.filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.filter-controls select {
    padding: 10px 12px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    :root {
        --font-size-base: 16px;
    }

    body {
        padding: var(--space-sm);
        background: linear-gradient(135deg, #F5F3EF 0%, #FAF9F7 50%, #F9F6F1 100%);
    }

    /* Keep decorative elements on mobile */
    body::before,
    body::after {
        display: block;
    }

    header h1 {
        font-size: 2em;
    }

    .auth-box,
    .content-box {
        padding: var(--space-md);
    }

    .content-box.wide {
        padding: var(--space-md);
    }

    .members-grid {
        grid-template-columns: 1fr;
    }

    .app-nav {
        flex-wrap: wrap;
    }

    .nav-btn {
        flex: 1 1 calc(50% - 4px);
    }

    .nav-btn.logout {
        flex: 1 1 100%;
    }

    .tag-input-field {
        flex-direction: column;
    }

    .browse-tags-btn {
        width: 100%;
    }

    .browse-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle {
        display: none; /* Hide view toggle on mobile - grid view only */
    }

    .members-table-container {
        overflow-x: auto;
    }

    .members-table {
        font-size: 0.9em;
    }

    .members-table th,
    .members-table td {
        padding: var(--space-sm);
    }

    .table-tags {
        max-width: 200px;
    }

    .filter-controls {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: var(--space-sm);
        padding: var(--space-md);
    }

    /* Fix Ask for Help button on mobile - full width, no float */
    #ask-for-help-btn {
        width: 100%;
        float: none;
        margin-top: 0;
        margin-bottom: var(--space-md);
        display: block;
        background-color: #FC6A03;
    }
}

/* ========================================
   ABOUT PAGE
   ======================================== */

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-section {
    margin-bottom: var(--space-xl);
}

.about-section h3 {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.about-section p {
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.about-section ul {
    list-style: none;
    padding-left: 0;
}

.about-section ul li {
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    padding-left: var(--space-md);
    position: relative;
}

.about-section ul li::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.about-section ol {
    counter-reset: item;
    list-style: none;
    padding-left: 0;
}

.about-section ol li {
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    padding-left: var(--space-lg);
    position: relative;
    counter-increment: item;
}

.about-section ol li::before {
    content: counter(item) ".";
    color: var(--accent);
    font-weight: 600;
    position: absolute;
    left: 0;
    font-size: 1.1em;
}

.about-section a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.about-section a:hover {
    border-bottom-color: var(--accent);
}

.contact-form {
    background: var(--surface-soft);
    padding: var(--space-lg);
    border-radius: 12px;
    margin-top: var(--space-md);
}

.contact-form .form-field {
    margin-bottom: var(--space-md);
}

.contact-form label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1em;
    transition: border-color 0.2s ease;
}

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

.contact-form textarea {
    resize: vertical;
}

.contact-form .btn {
    margin-top: var(--space-sm);
}

/* ========================================
   FOOTER
   ======================================== */

.site-footer {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    margin-top: var(--space-xxl);
    border-top: 1px solid var(--border);
}

.site-footer p {
    margin: var(--space-xs) 0;
    color: var(--text-secondary);
}

.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: var(--accent);
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus visible styles for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
}

.skip-to-content:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
    background: var(--accent);
    color: var(--surface);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    text-decoration: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: #999;
        --text-secondary: #000;
    }
}
