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

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Screen Management */
.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.screen.hidden {
    display: none;
}

/* Loading Screen */
#loadingScreen {
    flex-direction: column;
    gap: 20px;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loadingScreen p {
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Auth Screen */
.auth-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 32px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.4s ease-out;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 42px;
    font-weight: 800;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.auth-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.auth-btn:hover::before {
    width: 300px;
    height: 300px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.auth-btn:active {
    transform: translateY(0);
}

.google-btn {
    border-color: #4285F4;
}

.google-btn:hover {
    border-color: #4285F4;
    background: #f8f9ff;
}

.linkedin-btn {
    border-color: #0077B5;
}

.linkedin-btn:hover {
    border-color: #0077B5;
    background: #f0f7ff;
}

.email-btn {
    background: var(--bg-gradient);
    color: white;
    border: none;
}

.email-btn:hover {
    box-shadow: var(--shadow-lg);
}

.auth-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    background: var(--card-bg);
    padding: 0 16px;
    color: var(--text-secondary);
    font-size: 14px;
    position: relative;
}

.email-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
}

.email-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* App Container */
#appContainer {
    min-height: 100vh;
    padding-bottom: 80px;
    background: #f9fafb;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.view {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease-out;
    width: 100%;
    box-sizing: border-box;
}

.view.hidden {
    display: none;
}

/* fadeIn animation moved to bottom with other animations */

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 16px 0;
}

.view-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    color: var(--text-primary);
}

.icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--primary);
    color: white;
}

.icon-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.icon-btn:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.4);
    outline-offset: 2px;
}

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

/* Action Cards */
.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.action-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    border: 2px solid transparent;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.action-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    background: var(--bg-gradient);
    color: white;
}

.card-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.pass-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.manual-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.action-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.action-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Current Event Banner */
.current-event-banner {
    background: white;
    border-radius: 16px;
    padding: 16px 20px;
    margin: 16px 20px 24px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.current-event-banner:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-left-width: 6px;
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.banner-content > div {
    flex: 1;
    min-width: 0;
}

.banner-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.banner-content span {
    color: var(--text-secondary);
    margin-left: 8px;
}

/* Events Search */
.events-search-container {
    margin-bottom: 16px;
}

/* Events Filters */
.events-filters {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.events-filters:hover {
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    border-color: rgba(102, 126, 234, 0.2);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 44px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    background: white;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    border-radius: 4px;
}

.search-clear:hover {
    color: var(--text-primary);
    background: var(--border-color);
}

.search-clear.hidden {
    display: none;
}

/* Contacts Search */
.search-container {
    margin: 16px 20px;
    width: calc(100% - 40px);
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-wrapper .search-input {
    width: 100%;
    padding: 12px 40px 12px 44px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    background: white;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.search-wrapper .search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-wrapper .search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    border-radius: 4px;
    z-index: 10;
}

.search-wrapper .search-clear:hover {
    color: var(--text-primary);
    background: var(--border-color);
}

/* Events List */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.event-card {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.event-card.event-selected {
    border: 2px solid var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.event-card.event-selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    border-radius: 16px 0 0 16px;
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.event-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.event-location {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.event-dates {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.event-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.event-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Contacts Filters */
.contacts-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    align-items: center;
    animation: slideDown 0.3s ease;
}

.contacts-filters.hidden {
    display: none;
}

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

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

.filter-select {
    flex: 1;
    min-width: 150px;
    padding: 12px 16px;
    padding-right: 40px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-select:hover {
    border-color: var(--primary);
    background-color: rgba(102, 126, 234, 0.02);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(102, 126, 234, 0.1);
    background-color: white;
    transform: translateY(-1px);
}

.custom-date-range {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 100%;
    padding: 8px 0;
    animation: slideDown 0.3s ease-out;
}

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

.custom-date-range.hidden {
    display: none;
}

.filter-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    color: var(--text-primary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.filter-input:hover {
    border-color: var(--primary);
    background-color: rgba(102, 126, 234, 0.02);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(102, 126, 234, 0.1);
    background-color: white;
    transform: translateY(-1px);
}

/* Events Filters Responsive */
@media (max-width: 768px) {
    .events-filters {
        padding: 16px;
    }
    
    .events-filters > div {
        flex-direction: column;
        align-items: stretch;
        gap: 12px !important;
    }
    
    .events-filters > div > div:first-child {
        flex-direction: column;
        align-items: stretch;
        min-width: 100% !important;
    }
    
    .events-filters label {
        margin-bottom: 8px;
    }
    
    .filter-select,
    .filter-input {
        width: 100%;
        min-width: 100% !important;
    }
    
    .custom-date-range {
        flex-direction: column;
        align-items: stretch;
        min-width: 100% !important;
    }
    
    #clearEventsFiltersBtn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .contacts-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select,
    .filter-input {
        width: 100%;
    }
    
    .custom-date-range {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Contacts List */
.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.contact-card .contact-actions-list {
    flex-shrink: 0;
}

.contact-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.favorite-contact-btn {
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.favorite-contact-btn:hover {
    color: #f59e0b;
    transform: scale(1.1);
}

.favorite-contact-btn.favorite-active {
    color: #f59e0b;
}

.favorite-contact-btn.favorite-active:hover {
    color: #d97706;
}

.contact-photo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.contact-info {
    flex: 1;
}

.contact-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.contact-role {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 4px;
}

.contact-email,
.contact-mobile {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 2px;
}

.contact-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.contact-tags .tag {
    font-size: 11px;
    padding: 3px 8px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

.contact-date {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 8px;
}

/* Profile Display */
.profile-display {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.profile-photo-large {
    margin: 0 auto 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
}

.profile-photo-large img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center center;
    border: 4px solid var(--primary);
    box-shadow: var(--shadow-md);
    display: block;
    margin: 0 auto;
}

.profile-display h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    word-wrap: break-word;
}

.profile-role {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
    word-wrap: break-word;
}

.profile-qr-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid var(--border-color);
    width: 100%;
}

.profile-qr-section h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.profile-qr-section canvas {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    max-width: 100%;
    height: auto;
}

.profile-qr-section .btn-primary {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

/* QR Mode Toggle */
.qr-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Offline Indicator */
.offline-indicator {
    animation: pulse 2s infinite;
}

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

/* Network status badge */
.network-status {
    position: fixed;
    top: 60px;
    right: 16px;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.network-status.offline {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border-color: rgba(255, 193, 7, 0.3);
}

/* Contact Actions */
.contact-actions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
}

.contact-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
}

.contact-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-height: 90px;
}

.contact-action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.contact-action-btn:active {
    transform: translateY(0);
}

.contact-action-btn svg {
    width: 28px;
    height: 28px;
    stroke-width: 2;
}

.contact-action-btn:hover svg {
    stroke: white;
    fill: white;
}

.contact-action-btn span {
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 480px) {
    .contact-actions-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .contact-action-btn {
        padding: 12px 8px;
        min-height: 80px;
        font-size: 11px;
    }
    
    .contact-action-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* Chat Window */
.contact-chat-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
}

.chat-messages {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 12px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 85%;
    word-wrap: break-word;
}

.chat-message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    opacity: 0.7;
}

.chat-message-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.chat-input-container {
    width: 100%;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 24px;
    padding: 8px 12px;
}

.chat-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
    padding: 4px 8px;
}

.chat-input::placeholder {
    color: var(--text-secondary);
}

.chat-send-btn {
    background: var(--primary);
    border: none;
    cursor: pointer;
    color: white;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--primary-dark, #5568d3);
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chat-photo-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.chat-empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 48px 20px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    margin: 16px;
}

.chat-empty-state::before {
    content: '💬';
    display: block;
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

@media (max-width: 480px) {
    .chat-messages {
        max-height: 250px;
        min-height: 120px;
    }
    
    .chat-message {
        max-width: 90%;
    }
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--bg-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.btn-primary:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.4);
    outline-offset: 2px;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-secondary:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.4);
    outline-offset: 2px;
}

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

.btn-small {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.btn-small svg {
    flex-shrink: 0;
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.btn-danger:focus-visible {
    outline: 3px solid rgba(239, 68, 68, 0.4);
    outline-offset: 2px;
}

.btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

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

.modal-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--border-color);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

.modal-close:focus-visible {
    outline: 3px solid rgba(239, 68, 68, 0.4);
    outline-offset: 2px;
}

.modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

.modal-body {
    padding: 24px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
}

.input-field,
.textarea-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.input-field:hover,
.textarea-field:hover {
    border-color: rgba(102, 126, 234, 0.3);
}

.input-field:focus,
.textarea-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-field:disabled,
.textarea-field:disabled {
    background: #f9fafb;
    cursor: not-allowed;
    opacity: 0.6;
}

.input-field:invalid:not(:focus):not(:placeholder-shown),
.textarea-field:invalid:not(:focus):not(:placeholder-shown) {
    border-color: var(--danger);
}

.input-field:valid:not(:focus):not(:placeholder-shown),
.textarea-field:valid:not(:focus):not(:placeholder-shown) {
    border-color: var(--success);
}

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

.char-count {
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Photo Upload */
.photo-upload-area {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    border: 3px dashed var(--border-color);
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.photo-upload-area:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.photo-upload-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

/* Tags */
.tags-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    min-height: 50px;
    background: white;
}

.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.tag-remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
}

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

.tag-input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 100px;
    font-size: 14px;
}

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

.tag-suggestion {
    padding: 6px 12px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.tag-suggestion:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-1px);
}

.tag-suggestion.tag-custom {
    border-color: var(--accent);
    background: rgba(240, 147, 251, 0.1);
}

.tag-suggestion.tag-custom:hover {
    border-color: var(--accent);
    background: rgba(240, 147, 251, 0.2);
}

.tag-section-header {
    width: 100%;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    margin-top: 8px;
}

/* Tag Management */
.tags-management {
    padding: 0;
}

.tags-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tag-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.tags-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    gap: 16px;
}

.tag-item.tag-hidden {
    opacity: 0.6;
    background: #f5f5f5;
}

.tag-item-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0; /* Allow flex item to shrink */
}

.tag-name {
    font-weight: 500;
    /* Color will be set inline by JavaScript */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.tag-badge-system {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.tag-badge-hidden {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

.tag-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.tag-item-actions .btn-small {
    white-space: nowrap;
    font-size: 12px;
    padding: 6px 12px;
}

/* Public Profile View */
.public-profile-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px 24px;
    box-sizing: border-box;
}

.public-profile-card {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.public-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.public-profile-brand {
    font-weight: 600;
    color: var(--text-primary, #111827);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.brand-dot {
    width: 10px;
    height: 10px;
    background: linear-gradient(120deg, #667eea, #764ba2);
    border-radius: 50%;
    display: inline-block;
}

.public-profile-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #4b5563);
    font-size: 14px;
    cursor: pointer;
}

.public-profile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 0;
}

.public-profile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.public-profile-content.hidden {
    display: none;
}

.public-profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 32px;
    overflow: hidden;
    background: rgba(102, 126, 234, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.public-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.public-profile-photo .photo-placeholder {
    font-size: 48px;
}

.public-profile-role {
    color: var(--text-secondary, #4b5563);
    font-size: 16px;
    margin: 0;
}

.public-profile-about {
    color: var(--text-primary, #111827);
    font-size: 15px;
    line-height: 1.4;
    margin: 0;
}

.public-profile-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.public-profile-action {
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary, #111827);
    background: rgba(102, 126, 234, 0.05);
    font-size: 14px;
}

.public-profile-action svg {
    color: #667eea;
}

.public-profile-meta {
    width: 100%;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.meta-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 4px;
}

.public-profile-cta {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.public-profile-error {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    padding: 16px;
    border-radius: 12px;
    text-align: center;
}

.public-profile-footer {
    margin-top: 16px;
    color: #475467;
    font-size: 13px;
    text-align: center;
}

#publicProfileScreen .btn-primary {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    background: linear-gradient(120deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
}

#publicProfileScreen .btn-secondary {
    width: 100%;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    background: transparent;
    color: #4f46e5;
    cursor: pointer;
}

@media (max-width: 640px) {
    .tag-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .tag-item-content {
        width: 100%;
    }
    
    .tag-item-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .tag-item-actions .btn-small {
        flex: 1;
        min-width: 0;
        font-size: 11px;
        padding: 6px 8px;
    }
    
    .tag-view-contacts-btn {
        flex: 1 1 100%;
        width: 100%;
        margin-bottom: 4px;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Icon action buttons for contacts */
.icon-btn-action {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.icon-btn-action:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.icon-btn-action:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.icon-btn-action.icon-btn-danger {
    background: var(--card-bg);
    color: var(--danger, #ef4444);
}

.icon-btn-action.icon-btn-danger:hover {
    background: var(--danger, #ef4444);
    color: white;
}

/* AI Follow-up buttons with special styling */
#aiEmailBtn,
#aiWhatsAppBtn,
#aiSmsBtn {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    overflow: hidden;
}

#aiEmailBtn::before,
#aiWhatsAppBtn::before,
#aiSmsBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

#aiEmailBtn:hover::before,
#aiWhatsAppBtn:hover::before,
#aiSmsBtn:hover::before {
    left: 100%;
}

#aiEmailBtn:hover,
#aiWhatsAppBtn:hover,
#aiSmsBtn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.contact-actions-list {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Profile Completeness */
.profile-completeness-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
}

.completeness-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.icon-btn-small {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.icon-btn-small:hover {
    background: var(--border-color);
    opacity: 1;
}

.completeness-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.completeness-percentage {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.completeness-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.completeness-progress {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.completeness-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.completeness-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.completeness-message.success {
    color: var(--success);
    font-weight: 600;
}

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

/* Contact/Profile View */
.contact-view-content {
    text-align: center;
}

.contact-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 24px;
    text-align: left;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 15px;
    color: var(--text-primary);
    word-break: break-word;
}

.detail-section {
    text-align: left;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* Date Range Selector */
.date-range-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.date-range-input {
    flex: 1;
    min-width: 0;
}

.date-range-separator {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0 4px;
    opacity: 0.7;
}

@media (max-width: 480px) {
    .date-range-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .date-range-separator {
        display: none;
    }
    
    .date-range-input {
        width: 100%;
    }
}

/* Location Autocomplete */
.location-autocomplete-container {
    position: relative;
}

.location-input {
    width: 100%;
}

.location-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.location-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.location-suggestion:hover,
.location-suggestion.active {
    background: rgba(102, 126, 234, 0.1);
}

.location-suggestion.loading,
.location-suggestion.no-results,
.location-suggestion.error {
    color: var(--text-secondary);
    cursor: default;
    font-style: italic;
}

.location-suggestion.loading:hover,
.location-suggestion.no-results:hover,
.location-suggestion.error:hover {
    background: transparent;
}

.location-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.location-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Media Upload */
.media-upload-area {
    margin-top: 8px;
}

.media-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.media-item {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.nav-btn svg {
    width: 24px;
    height: 24px;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Filter */
.filter-select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-secondary);
    font-size: 16px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    margin: 20px 0;
}

.empty-state::before {
    content: '📭';
    display: block;
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

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

.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 480px) {
    .view {
        padding: 16px;
        max-width: 100%;
    }
    
    .auth-container {
        padding: 32px 24px;
    }
    
    .action-cards {
        grid-template-columns: 1fr;
    }
    
    .event-actions {
        flex-direction: column;
    }
    
    .event-actions .btn {
        width: 100%;
    }
    
    .profile-display {
        padding: 24px 16px;
        border-radius: 16px;
    }
    
    .profile-photo-large {
        margin: 0 auto 20px;
    }
    
    .profile-photo-large img {
        width: 90px;
        height: 90px;
        border-width: 3px;
    }
    
    .profile-display h3 {
        font-size: 20px;
    }
    
    .profile-role {
        font-size: 14px;
    }
    
    .profile-qr-section {
        margin-top: 24px;
        padding-top: 24px;
    }
    
    .profile-qr-section h4 {
        font-size: 16px;
    }
    
    .profile-qr-section canvas {
        width: 100% !important;
        max-width: 250px;
        padding: 12px;
        box-sizing: border-box;
    }
    
    .profile-qr-section .btn-primary {
        max-width: 100%;
        width: 100%;
    }
    
    .profile-display {
        overflow-x: hidden;
    }
    
    #profileView {
        padding-bottom: 100px; /* Space for bottom nav */
    }
    
    .view-header {
        padding: 12px 0;
    }
    
    .view-header h2 {
        font-size: 24px;
    }

    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
        border-radius: 16px;
    }
    
    .modal-body {
        padding: 20px 16px;
    }
    
    .bulk-actions-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .bulk-actions-bar > div {
        flex-wrap: wrap;
    }
}

/* Bulk Selection Bar (Top) */
.bulk-selection-bar {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    margin: 0 20px 16px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.bulk-selection-bar #selectedCount {
    font-weight: 600;
    font-size: 15px;
}

.selection-actions {
    display: flex;
    gap: 8px;
}

/* Floating Bulk Actions Bar (Bottom) */
.bulk-actions-bar {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 24px;
    padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 1000;
    border: 2px solid var(--primary);
    min-width: auto;
    max-width: calc(100vw - 40px);
    animation: slideUp 0.3s ease-out;
    flex-wrap: nowrap;
    white-space: nowrap;
}

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

.bulk-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    border: none;
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 55px;
    max-width: 70px;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
}

.bulk-action-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bulk-action-btn.bulk-action-danger {
    background: var(--card-bg);
    color: var(--danger, #ef4444);
}

.bulk-action-btn.bulk-action-danger:hover {
    background: var(--danger, #ef4444);
    color: white;
}

.bulk-action-btn svg {
    flex-shrink: 0;
}

.bulk-action-btn span {
    font-size: 11px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .bulk-actions-bar {
        bottom: 90px;
        padding: 8px 10px;
        gap: 4px;
    }
    
    .bulk-action-btn {
        min-width: 48px;
        max-width: 60px;
        padding: 5px 6px;
        font-size: 11px;
    }
    
    .bulk-action-btn span {
        font-size: 9px;
    }
    
    .bulk-action-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Selection mode styles */
.contact-card.selectable {
    cursor: pointer;
}

.contact-card.selectable:hover {
    background: rgba(102, 126, 234, 0.05);
}

.contact-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 20px;
    height: 20px;
    z-index: 10;
    cursor: pointer;
}

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}

.toast {
    background: white;
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
    border-left: 3px solid var(--primary);
}

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

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

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

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

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    font-size: 13px;
}

.toast-message {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.removing {
    animation: slideOut 0.3s ease-in forwards;
}

@media (max-width: 768px) {
    .toast-container {
        right: 12px;
        left: 12px;
        max-width: none;
    }
}

/* Bulk Tag Modal Improvements */
.bulk-tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.bulk-tag-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    border: 2px solid;
    transition: all 0.2s ease;
    margin: 0;
}

.bulk-tag-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.bulk-tag-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.bulk-tag-item input[type="checkbox"]:checked {
    accent-color: var(--primary);
}

.bulk-tag-badge {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    text-align: left;
}

.tags-checkbox-list {
    padding: 4px;
}

.tags-checkbox-list::-webkit-scrollbar {
    width: 6px;
}

.tags-checkbox-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.tags-checkbox-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.tags-checkbox-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

@media (max-width: 480px) {
    .bulk-tags-grid {
        grid-template-columns: 1fr;
    }
}

/* Export Modal Styles */
.export-format-btn:hover {
    border-color: var(--primary) !important;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(240, 147, 251, 0.05) 100%) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.export-format-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

#exportProgress, #exportSuccess, #exportError {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Scanner Modal Styles */
.fullscreen-modal {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    padding: 0;
    overflow: hidden;
}

.fullscreen-modal .modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fullscreen-modal .modal-header h3 {
    color: white;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.fullscreen-modal .modal-header .modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.fullscreen-modal .modal-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fullscreen-modal .modal-body {
    position: relative;
    width: 100%;
    height: 100vh;
    padding: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Video elements - proper proportions */
#qrVideo,
#businessCardVideo,
#eventPassVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    position: absolute;
    top: 0;
    left: 0;
}

/* Scanner Overlay */
.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

/* Scanner Frame - Square for QR, Rectangle for cards */
.scanner-frame {
    position: relative;
    border: 3px solid rgba(102, 126, 234, 0.8);
    border-radius: 12px;
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    animation: scannerPulse 2s ease-in-out infinite;
}

/* QR Scanner Frame - Square */
#qrScannerModal .scanner-frame {
    width: 280px;
    height: 280px;
}

/* Card Scanner Frame - Rectangle */
#businessCardScannerModal .scanner-frame,
#eventPassScannerModal .scanner-frame {
    width: 320px;
    height: 200px;
    max-width: 85vw;
    max-height: 50vh;
}

/* Scanner Corner Indicators */
.scanner-frame {
    position: relative;
    overflow: visible;
}

.scanner-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 4px solid rgba(102, 126, 234, 1);
    z-index: 1;
}

.scanner-corner-top-left {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 12px;
}

.scanner-corner-top-right {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 12px;
}

.scanner-corner-bottom-left {
    bottom: -3px;
    left: -3px;
    border-right: none;
    border-top: none;
    border-bottom-left-radius: 12px;
}

.scanner-corner-bottom-right {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 12px;
}

/* Scanning Line Animation */
.scanner-frame::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(102, 126, 234, 0.8) 20%,
        rgba(118, 75, 162, 0.9) 50%,
        rgba(102, 126, 234, 0.8) 80%,
        transparent
    );
    animation: scanLine 2s linear infinite;
    border-radius: 0;
    z-index: 2;
}

/* Scanner Animations */
@keyframes scannerPulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5),
                    0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5),
                    0 0 20px 5px rgba(102, 126, 234, 0.6);
    }
}

@keyframes scanLine {
    0% {
        top: 0;
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

/* Scanner Hint Text */
.scanner-hint {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 24px;
    pointer-events: none;
    white-space: nowrap;
}

/* Scanner Control Buttons */
#businessCardCaptureBtn,
#businessCardUploadBtn,
#eventPassCaptureBtn,
#eventPassUploadBtn {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.2s;
}

#businessCardCaptureBtn:hover,
#eventPassCaptureBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

#businessCardUploadBtn:hover,
#eventPassUploadBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.9);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #qrScannerModal .scanner-frame {
        width: 250px;
        height: 250px;
    }
    
    #businessCardScannerModal .scanner-frame,
    #eventPassScannerModal .scanner-frame {
        width: 280px;
        height: 175px;
    }
    
    .scanner-hint {
        font-size: 14px;
        padding: 10px 20px;
        bottom: 120px;
    }
    
    #businessCardCaptureBtn,
    #businessCardUploadBtn,
    #eventPassCaptureBtn,
    #eventPassUploadBtn {
        padding: 10px 20px;
        font-size: 14px;
    }
}
