/* know.contact Styles
 * Dark mode professional design with teal accent
 * All colors use CSS variables for easy theming
 */

/* ===== CSS VARIABLES (DARK MODE DESIGN SYSTEM) ===== */
:root {
    /* Teal Accent - Signature Color */
    --accent: #14b8a6;
    --accent-hover: #0d9488;
    --accent-dim: #0f766e;

    /* Aliases for backwards compatibility */
    --primary: var(--accent);
    --primary-dark: var(--accent-hover);
    --primary-hover: var(--accent-hover);

    /* Dark Mode Backgrounds */
    --bg: #0a0a0a;
    --bg-elevated: #1a1a1a;
    --background: var(--bg);
    --card-bg: #262626;
    --card-hover: #2d2d2d;
    --overlay: rgba(0, 0, 0, 0.7);

    /* Text Hierarchy */
    --text: #e5e5e5;
    --text-secondary: #a3a3a3;
    --text-tertiary: #737373;
    --text-primary: var(--text);
    --text-muted: var(--text-tertiary);
    --text-on-primary: var(--bg);

    /* Borders - Subtle */
    --border: #404040;
    --border-light: #525252;
    --border-dark: var(--border-light);
    --border-focus: var(--accent);

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --info: var(--accent);

    /* Shadows - Darker for dark mode */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.6);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Typography - Inter for professional appearance */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;

    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-fast: all 0.1s ease;
}

/* Always dark mode - no light theme support */

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    min-height: 100vh;
}

/* ===== SKIP LINK (ACCESSIBILITY) ===== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: var(--text-on-primary);
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 var(--radius) 0;
    font-weight: 500;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

/* ===== HEADER ===== */
.app-header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    white-space: nowrap;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: opacity 0.2s;
}

/* Split logo styling - "know" in purple, ".contact" theme-aware */
.logo-know {
    color: var(--primary);
}

.logo-contact {
    color: var(--text-primary);
}

.logo:hover {
    opacity: 0.8;
}

/* Hamburger menu button (hidden on desktop) */
.menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text);
    transition: opacity 0.2s;
}

.menu-btn:hover {
    opacity: 0.7;
}

.menu-btn .lucide {
    width: 24px;
    height: 24px;
}

.search-bar-header {
    flex: 1;
    max-width: 500px;
}

.search-input-header {
    width: 100%;
    padding: 0.7em 1em;
    font-size: 1em;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    transition: border-color 0.15s;
}

.search-input-header:focus {
    outline: none;
    border-color: var(--primary);
    background: #f6faff;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-sm {
    padding: 0.5em 1em;
    font-size: 0.9em;
}

/* ===== MOBILE SEARCH BAR ===== */
.mobile-search-bar {
    display: none; /* Hidden on desktop */
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0; /* Sticky at the very top */
    z-index: 100; /* Above everything except modals */
}

.mobile-search-bar-inner {
    position: relative; /* For icon positioning */
}

.mobile-search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem; /* Extra left padding for icon */
    font-size: 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.15s;
}

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

.mobile-search-input::placeholder {
    color: var(--text-tertiary);
}

/* Search Results Dropdown (mobile only) */
.mobile-search-dropdown {
    display: none;
    position: fixed;
    top: 58px; /* Start BELOW the search bar */
    left: 0;
    right: 0;
    bottom: 80px; /* Above bottom nav */
    background: var(--bg);
    z-index: 90; /* Below search bar (which is 100) */
    overflow-y: auto;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.mobile-search-dropdown.active {
    display: block;
}

.mobile-search-results {
    padding: 1rem;
}

.mobile-search-result-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-search-result-item:hover,
.mobile-search-result-item:active {
    background: var(--card-hover);
    border-color: var(--accent);
}

.mobile-search-result-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.mobile-search-result-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Bottom Navigation Bar (mobile only) */
.bottom-nav {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding: 0.5rem;
}

.bottom-nav-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    height: 100%;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition-fast);
    padding: 0.25rem;
}

.bottom-nav-item:hover,
.bottom-nav-item:active {
    background: var(--card-bg);
    color: var(--accent);
}

.bottom-nav-item.active {
    color: var(--accent);
}

.bottom-nav-item i {
    width: 24px;
    height: 24px;
}

/* ===== LAYOUT ===== */
.app-container {
    display: flex;
    height: calc(100vh - 70px);
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.sidebar h3:first-child {
    margin-top: 0;
}

/* New sidebar sections */
.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section-title {
    padding: 0 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

.sidebar-item {
    padding: 0.75rem 1.5rem;
    margin-bottom: 0;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s;
    color: var(--text);
    text-decoration: none;
    width: 100%;
    text-align: left;
    border: none;
    border-left: 3px solid transparent;
    background: none;
    font-size: var(--text-base);
    font-family: var(--font-sans);
}

.sidebar-item:hover {
    background: var(--card-hover);
}

.sidebar-item.active {
    background: var(--card-bg);
    border-left-color: var(--accent);
    font-weight: 500;
}

.sidebar-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Sidebar item components */
.sidebar-item-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.sidebar-item-label {
    flex: 1;
}

.sidebar-item-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.sidebar-item-arrow {
    color: var(--text-secondary);
    font-size: 0.875rem;
    width: 16px;
    height: 16px;
}

/* Main Area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== TAB NAVIGATION ===== */
.tab-nav {
    background: var(--card-bg);
    border-bottom: 2px solid var(--border);
    display: flex;
    padding: 0 2rem;
    gap: 0.5rem;
    flex-shrink: 0;
}

.tab-button {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.tab-button:hover {
    color: var(--text-primary);
    background: var(--background);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-button .badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 0.15em 0.4em;
    border-radius: 10px;
    font-weight: 700;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: none;
}

.tab-content.active {
    display: block;
}

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

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

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

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    color: var(--text-secondary);
}

/* ===== CONTACT LIST ===== */
.contact-list {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.contact-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.contact-item:hover {
    box-shadow: 0 6px 32px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.contact-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.contact-name {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3em;
}

.contact-meta {
    font-size: 0.95em;
    color: var(--text-secondary);
    display: flex;
    gap: 0.5em;
}

.contact-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.contact-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ===== TAGS ===== */
.tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #525252; /* Much lighter gray */
    color: #0a0a0a; /* Nearly black text */
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700; /* Bold */
}

.tag.tag-sm {
    padding: 1px 6px;
    font-size: 0.7rem;
}

/* ===== CONTACT DETAIL VIEW ===== */
.detail-view {
    max-width: 800px;
    margin: 0 auto;
}

.detail-header {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem; /* Visible gap between header and sections */
}

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

.detail-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
    font-size: 0.875rem;
}

.detail-back:hover {
    background: var(--card-hover);
    border-color: var(--border-light);
}

.detail-back .lucide {
    width: 16px;
    height: 16px;
}

.action-btns {
    display: flex;
    gap: 0.5rem;
}

.detail-main {
    text-align: left;
}

.detail-name {
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text);
}

.detail-title {
    color: var(--text-secondary);
    font-size: 1rem;
}

.detail-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.detail-row {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row-icon {
    font-size: 1.25rem;
    color: var(--text-secondary);
    width: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    padding-top: 0.25rem;
}

.detail-row-icon .lucide {
    width: 20px;
    height: 20px;
}

.detail-row-content {
    flex: 1;
    min-width: 0; /* Important for overflow handling */
}

.detail-row-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}

.detail-row-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
}

.detail-row-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: auto; /* Push buttons to the right */
}

.detail-row-btn {
    padding: 0.25rem 0.5rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text);
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.detail-row-btn:hover {
    background: var(--card-hover);
    border-color: var(--border-light);
}

.detail-row-value {
    color: var(--text);
    font-size: 0.95rem;
    /* Overflow protection */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Auto-shrink for really long values on mobile */
@media (max-width: 480px) {
    .detail-row-value {
        font-size: clamp(0.7rem, 2.5vw, 0.95rem);
        word-break: break-all;
        white-space: normal;
    }
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-base);
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.5;
}

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

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

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--card-hover);
    border-color: var(--border-dark);
}

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

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

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-sm);
}

.btn-lg {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-lg);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
    vertical-align: middle;
}

.btn-icon:hover {
    opacity: 1;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: var(--space-md);
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-sm);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Custom dropdown arrow for select (no gradient) */
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(97, 63, 180, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-help {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ===== SEARCH BAR ===== */
.search-bar {
    position: relative;
    margin-bottom: var(--space-lg);
}

.search-input {
    width: 100%;
    padding: var(--space-md);
    padding-left: 40px;
    font-size: var(--text-lg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(97, 63, 180, 0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ===== MODALS ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-2xl);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--card-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    text-align: center;
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

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

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

/* ===== RESPONSIVE (MOBILE) ===== */
@media (max-width: 768px) {
    .app-header {
        padding: 1rem;
        gap: 1rem;
    }

    /* Hide hamburger menu on mobile (bottom nav replaces sidebar) */
    .menu-btn {
        display: none;
    }

    /* Hide desktop search on mobile */
    .search-bar-header {
        display: none;
    }

    /* Show mobile search bar */
    .mobile-search-bar {
        display: block;
    }

    /* Add top padding to contact list to prevent overlap with sticky search */
    #contact-list-view {
        padding-top: 1rem;
    }

    /* Show bottom nav on mobile */
    .bottom-nav {
        display: block;
    }

    /* Add padding to main content to account for bottom nav */
    .main-area {
        padding-bottom: 90px; /* 70px nav + 20px spacing */
    }

    .header-actions {
        display: flex;
        gap: 0.5rem;
    }

    /* Hide Settings button on mobile (accessible via bottom nav More) */
    #btn-settings-header {
        display: none;
    }

    /* Shrink Add Contact button to just + icon on mobile */
    #btn-add-contact-header {
        padding: 0.5rem;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        font-size: 1.25rem;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #btn-add-contact-header::before {
        content: '+';
    }

    /* Hide the button text */
    #btn-add-contact-header {
        font-size: 0; /* Hide text */
    }

    #btn-add-contact-header::before {
        font-size: 1.25rem; /* Show + at normal size */
    }

    /* Mobile sidebar overlay */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0; /* Changed from 73px to align with sticky search */
        height: 100vh;
        z-index: 200;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
        width: 280px;
    }

    .sidebar.open {
        left: 0;
    }

    .app-container {
        flex-direction: column;
        height: auto;
    }

    .tab-nav {
        padding: 0 1rem;
    }

    .tab-content {
        padding: 1rem;
    }

    .contact-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ===== LOADING STATES ===== */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.3;
}

.empty-state-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.empty-state-text {
    font-size: var(--text-base);
    margin-bottom: var(--space-lg);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 80px; /* Below header */
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 280px;
    pointer-events: all;
    cursor: pointer;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-info {
    border-left-color: var(--info);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon .lucide {
    width: 20px;
    height: 20px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

.toast-message {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: 1.4;
}

.toast.toast-dismissing {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Mobile toast positioning */
@media (max-width: 768px) {
    .toast-container {
        top: auto;
        bottom: 90px; /* Above bottom nav */
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}

/* Markdown Content Styling */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-content h1 { font-size: 1.5em; }
.markdown-content h2 { font-size: 1.3em; }
.markdown-content h3 { font-size: 1.1em; }

.markdown-content p {
    margin-bottom: 0.75em;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0.5em 0 0.75em 1.5em;
    padding: 0;
}

.markdown-content li {
    margin-bottom: 0.25em;
}

.markdown-content code {
    background: var(--bg-elevated);
    padding: 0.125em 0.25em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background: var(--bg-elevated);
    padding: 0.75em;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 0.5em 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 0.5em 0;
    padding-left: 1em;
    color: var(--text-secondary);
}

.markdown-content a {
    color: var(--accent);
    text-decoration: underline;
}

.markdown-content a:hover {
    color: var(--accent-hover);
}

.markdown-content strong {
    font-weight: 600;
}

.markdown-content em {
    font-style: italic;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1em 0;
}
