/* Event Check-In System Styles */

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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

/* ============================================
   LOGIN SCREEN
   ============================================ */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    padding: 1rem;
}

.login-container {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 500;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
}

.login-form .form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.login-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-align: center;
    min-height: 1.25rem;
}

.btn-login {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    justify-content: center;
}

.btn-login svg {
    width: 20px;
    height: 20px;
}

/* Header with logout button */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

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

.sync-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.sync-status.online {
    color: #86efac;
}

.sync-status.online .sync-dot {
    background: #22c55e;
    animation: pulse 2s infinite;
}

.sync-status.offline {
    color: #fca5a5;
}

.sync-status.offline .sync-dot {
    background: #ef4444;
}

.sync-status.offline .sync-text::after {
    content: 'Offline';
}

.sync-status.online .sync-text::after {
    content: 'Synced';
}

.sync-text {
    display: none;
}

@media (min-width: 400px) {
    .sync-text {
        display: inline;
    }
    .sync-text::after {
        content: none !important;
    }
}

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

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

/* App container */
.app-container {
    min-height: 100vh;
}

@media (max-width: 480px) {
    .login-container {
        padding: 1.5rem;
    }

    .login-header h1 {
        font-size: 1.5rem;
    }

    .login-form .form-group input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Main Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Stats Dashboard */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    border: 2px solid transparent;
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.clickable:active {
    transform: translateY(0);
}

.stat-card.active {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.stat-card.highlight.active {
    border-color: var(--success-color);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

.stat-card.highlight {
    background: var(--success-light);
    border: 2px solid var(--success-color);
}

.stat-card.highlight .stat-value {
    color: var(--success-color);
}

/* Progress Bar */
.progress-container {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.progress-bar-wrapper {
    background: var(--gray-200);
    border-radius: 999px;
    height: 24px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--success-color), #34d399);
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* Search Section */
.search-section {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.search-wrapper {
    display: flex;
    gap: 0.5rem;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    font-size: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.search-input-wrapper::before {
    content: '🔍';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.clear-btn {
    padding: 0.875rem 1rem;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.clear-btn:hover {
    background: var(--gray-200);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

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

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

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

/* Guest List */
.guest-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.guest-list-header h2 {
    font-size: 1.125rem;
    color: var(--gray-700);
}

.guest-list-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sort-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-700);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    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='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.sort-select:hover {
    border-color: var(--gray-300);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#resultCount {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.guest-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.guest-card {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid var(--gray-300);
    transition: transform 0.2s, box-shadow 0.2s;
}

.guest-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.guest-card.checked-in {
    border-left-color: var(--success-color);
    background: linear-gradient(90deg, var(--success-light), white 30%);
}

.guest-info {
    flex: 1;
    min-width: 0;
}

.guest-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.guest-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.guest-mobile, .guest-count {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.checkin-time {
    font-size: 0.8rem;
    color: var(--success-color);
    margin-top: 0.25rem;
}

.guest-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-checkin {
    background: var(--success-color);
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    min-width: 100px;
}

.btn-checkin:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-undo {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.btn-undo:hover {
    background: var(--gray-200);
}

.status-badge {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
}

.status-checked {
    background: var(--success-light);
    color: var(--success-color);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-walkin {
    background: #fef3c7;
    color: #d97706;
}

.badge-adjusted {
    background: #dbeafe;
    color: #2563eb;
}

/* Quick Action Icons */
.quick-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.quick-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gray-100);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--gray-500);
}

.quick-action-btn:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.quick-action-btn:active {
    transform: scale(0.95);
}

.quick-action-btn svg {
    width: 18px;
    height: 18px;
}

.quick-action-danger:hover {
    background: #fef2f2;
    color: var(--danger-color);
}

/* Guest Menu (Kebab Menu) - kept for backwards compatibility */
.guest-menu {
    position: relative;
}

.menu-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.menu-btn:hover {
    background: var(--gray-100);
}

.menu-dots {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--gray-500);
    line-height: 1;
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    min-width: 140px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    color: var(--gray-700);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s;
}

.menu-item:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

.menu-item:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

.menu-item:hover {
    background: var(--gray-50);
}

.menu-item-danger {
    color: var(--danger-color);
}

.menu-item-danger:hover {
    background: #fef2f2;
}

/* View/Edit Modal Styles */
.view-guest-info {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.view-field {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.view-field:last-child {
    border-bottom: none;
}

.view-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.view-value {
    font-size: 1rem;
    color: var(--gray-800);
    font-weight: 500;
}

.view-value.status-success {
    color: var(--success-color);
}

.view-value.status-pending {
    color: var(--gray-500);
}

#editMode .modal-actions {
    justify-content: flex-end;
}

#editMode .modal-actions .btn-danger {
    margin-right: auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--gray-800);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0.25rem;
    line-height: 1;
}

.close-btn:hover {
    color: var(--gray-600);
}

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

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

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

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

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

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

/* Check-In Modal Specific Styles */
.checkin-guest-info {
    text-align: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.checkin-guest-name {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.checkin-guest-mobile {
    font-size: 0.95rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.checkin-registered-count {
    font-size: 0.85rem;
    color: var(--gray-600);
    background: white;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--gray-200);
}

.guest-count-selector {
    margin-bottom: 1rem;
}

.guest-count-selector label {
    display: block;
    text-align: center;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.count-adjuster {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.count-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    background: white;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.count-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.count-btn:active {
    transform: scale(0.95);
}

.count-minus:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.count-plus:hover {
    border-color: var(--success-color);
    color: var(--success-color);
}

.count-adjuster input {
    width: 80px;
    height: 64px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    color: var(--primary-color);
}

.count-adjuster input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Hide number input spinners */
.count-adjuster input::-webkit-outer-spin-button,
.count-adjuster input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.count-adjuster input[type=number] {
    -moz-appearance: textfield;
}

.quick-counts {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quick-count-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 0.75rem;
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
    background: white;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.quick-count-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.quick-count-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

#confirmCheckIn {
    min-width: 140px;
}

/* Smaller count adjuster for add guest form */
.count-adjuster.small {
    gap: 0.35rem;
}

.count-adjuster.small .count-btn {
    width: 44px;
    height: 44px;
    font-size: 1.35rem;
}

.count-adjuster.small input {
    width: 60px;
    height: 48px;
    font-size: 1.5rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-800);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   MOBILE OPTIMIZED STYLES
   ============================================ */

/* Touch-friendly base styles */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets for touch devices */
    .btn, .menu-btn, .count-btn, .quick-count-btn, .audit-tab {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .guest-card:hover,
    .btn-primary:hover,
    .btn-checkin:hover,
    .stat-card.clickable:hover {
        transform: none;
    }

    /* Add active states instead */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .guest-card:active {
        background: var(--gray-50);
    }
}

/* Tablet and below */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header p {
        font-size: 0.85rem;
    }

    .container {
        padding: 0.75rem;
    }

    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* Progress bar */
    .progress-container {
        padding: 0.75rem;
    }

    .progress-bar-wrapper {
        height: 20px;
    }

    /* Search */
    .search-section {
        padding: 0.75rem;
    }

    .search-input-wrapper input {
        padding: 0.75rem 1rem 0.75rem 2.5rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Action buttons - scrollable row */
    .action-buttons {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        margin: 0 -0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .action-buttons::-webkit-scrollbar {
        display: none;
    }

    .action-buttons .btn {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    /* Guest list header */
    .guest-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .guest-list-controls {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }

    .sort-select {
        flex: 1;
        max-width: none;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    #resultCount {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Guest cards - mobile optimized */
    .guest-card {
        flex-direction: column;
        align-items: stretch;
        padding: 0.875rem;
        gap: 0;
    }

    .guest-info {
        margin-bottom: 0.5rem;
    }

    .guest-name {
        font-size: 1.05rem;
    }

    .guest-details {
        font-size: 0.8rem;
        gap: 0.5rem;
    }

    .checkin-time {
        font-size: 0.75rem;
    }

    .guest-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--gray-200);
        gap: 0.5rem;
    }

    .quick-actions {
        order: -1;
    }

    .quick-action-btn {
        width: 40px;
        height: 40px;
    }

    .guest-menu {
        order: -1;
    }

    .btn-checkin {
        flex: 1;
        max-width: 150px;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        justify-content: center;
    }

    .btn-undo {
        padding: 0.5rem 1rem;
    }

    .status-badge {
        padding: 0.375rem 0.625rem;
        font-size: 0.8rem;
    }

    /* Modals - full screen on mobile */
    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 90vh;
        overflow-y: auto;
        padding: 1.25rem;
    }

    .modal-large {
        max-height: 95vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .modal-header {
        margin-bottom: 1rem;
        position: sticky;
        top: -1.25rem;
        background: white;
        padding: 1rem 0;
        margin: -1.25rem -1.25rem 1rem;
        padding: 1rem 1.25rem;
        border-bottom: 1px solid var(--gray-200);
        z-index: 10;
    }

    .modal-header h2 {
        font-size: 1.125rem;
    }

    .close-btn {
        font-size: 1.75rem;
        padding: 0.5rem;
    }

    /* Form inputs */
    .form-group input,
    .form-group select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem;
    }

    /* Count adjuster */
    .count-adjuster {
        gap: 0.75rem;
    }

    .count-btn {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
    }

    .count-adjuster input {
        width: 70px;
        height: 58px;
        font-size: 1.75rem;
    }

    .quick-counts {
        gap: 0.375rem;
    }

    .quick-count-btn {
        min-width: 48px;
        height: 48px;
        font-size: 1rem;
    }

    /* Modal actions */
    .modal-actions {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-actions .btn {
        width: 100%;
        padding: 0.875rem;
        justify-content: center;
    }

    /* Check-in modal */
    .checkin-guest-info {
        padding: 0.875rem;
    }

    .checkin-guest-name {
        font-size: 1.2rem;
    }

    /* Audit log modal */
    .audit-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 -1.25rem 1rem;
        padding: 0 1.25rem 0.5rem;
    }

    .audit-tabs::-webkit-scrollbar {
        display: none;
    }

    .audit-tab {
        white-space: nowrap;
        padding: 0.625rem 1rem;
    }

    .audit-toolbar {
        flex-direction: column;
    }

    .audit-filter {
        width: 100%;
        font-size: 16px;
    }

    .audit-toolbar .btn-sm {
        flex: 1;
    }

    .audit-log-list {
        max-height: 250px;
    }

    .audit-entry-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .snapshot-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .snapshot-stats {
        font-size: 0.8rem;
    }

    .snapshot-actions {
        flex-direction: column;
        width: 100%;
    }

    .snapshot-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .system-info-grid {
        grid-template-columns: 1fr;
    }

    /* Toast - above bottom nav area */
    .toast {
        bottom: 5rem;
        max-width: calc(100% - 2rem);
        font-size: 0.9rem;
        padding: 0.875rem 1.25rem;
    }

    /* Menu dropdown */
    .menu-dropdown {
        min-width: 160px;
    }

    .menu-item {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
}

/* Small phones */
@media (max-width: 400px) {
    .container {
        padding: 0.5rem;
    }

    .header {
        padding: 0.75rem;
    }

    .header h1 {
        font-size: 1.35rem;
    }

    .stats-dashboard {
        gap: 0.375rem;
    }

    .stat-card {
        padding: 0.625rem 0.5rem;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .progress-container {
        padding: 0.625rem;
    }

    .search-section {
        padding: 0.625rem;
    }

    .guest-card {
        padding: 0.75rem;
    }

    .guest-name {
        font-size: 1rem;
    }

    .badge {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }

    .action-buttons {
        margin: 0 -0.5rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .action-buttons .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .action-buttons .btn span:first-child {
        display: none; /* Hide icons on very small screens */
    }

    .modal-content {
        padding: 1rem;
    }

    .modal-header {
        margin: -1rem -1rem 1rem;
        padding: 0.875rem 1rem;
    }

    .count-btn {
        width: 48px;
        height: 48px;
        font-size: 1.35rem;
    }

    .count-adjuster input {
        width: 64px;
        height: 52px;
        font-size: 1.5rem;
    }

    .quick-count-btn {
        min-width: 44px;
        height: 44px;
        font-size: 0.95rem;
    }

    .audit-tabs {
        margin: 0 -1rem 1rem;
        padding: 0 1rem 0.5rem;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 0.5rem 1rem;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .header p {
        display: none;
    }

    .stats-dashboard {
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-card {
        padding: 0.5rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .modal {
        align-items: center;
    }

    .modal-content {
        max-width: 90%;
        max-height: 90vh;
        border-radius: var(--radius-lg);
    }

    .modal-large {
        max-width: 95%;
    }

    .modal-actions {
        flex-direction: row;
    }
}

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
    .header {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .container {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    .modal-content {
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    }

    .toast {
        bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 1rem));
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles here if needed */
}

/* ============================================
   MOBILE BOTTOM BAR
   ============================================ */

.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 0.75rem 1rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    z-index: 99;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .mobile-bottom-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    /* Add padding to bottom of page for mobile bar */
    body {
        padding-bottom: 80px;
    }

    @supports (padding: max(0px)) {
        body {
            padding-bottom: max(80px, calc(60px + env(safe-area-inset-bottom)));
        }
    }
}

.mobile-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.mobile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
}

.mobile-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.mobile-stat-label {
    font-size: 0.65rem;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-top: 2px;
}

.mobile-stat:first-child .mobile-stat-value {
    color: var(--success-color);
}

.mobile-stat-progress {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    max-width: 150px;
}

.mobile-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #34d399);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.mobile-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.mobile-fab:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.mobile-fab span {
    line-height: 1;
    margin-top: -2px;
}

/* Hide desktop add button on mobile when FAB is shown */
@media (max-width: 768px) {
    #addGuestBtn {
        display: none;
    }
}

/* Swipe hint animation for guest cards */
@keyframes swipeHint {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-10px); }
}

.guest-card.swipe-hint {
    animation: swipeHint 0.5s ease-in-out 2;
}

/* Pull to refresh indicator */
.pull-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--primary-color);
    color: white;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    z-index: 101;
    transform: translateY(-100%);
    transition: transform 0.3s;
}

.pull-indicator.visible {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .pull-indicator {
        display: flex;
    }
}

/* ============================================
   AUDIT LOG MODAL STYLES
   ============================================ */

.modal-large {
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.audit-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0.5rem;
}

.audit-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: var(--gray-500);
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s;
}

.audit-tab:hover {
    color: var(--gray-700);
    background: var(--gray-50);
}

.audit-tab.active {
    color: var(--primary-color);
    background: var(--gray-50);
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: -2px;
}

.audit-tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
}

.audit-tab-content.active {
    display: flex;
}

.audit-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.audit-filter {
    padding: 0.5rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
    flex: 1;
    min-width: 150px;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.audit-log-list {
    flex: 1;
    overflow-y: auto;
    max-height: 350px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-50);
}

.audit-entry {
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    background: white;
}

.audit-entry:last-child {
    border-bottom: none;
}

.audit-entry.action-success {
    border-left: 3px solid var(--success-color);
}

.audit-entry.action-danger {
    border-left: 3px solid var(--danger-color);
}

.audit-entry.action-warning {
    border-left: 3px solid var(--warning-color);
}

.audit-entry.action-info {
    border-left: 3px solid var(--primary-color);
}

.audit-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.audit-action-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    background: var(--gray-100);
    border-radius: 4px;
    color: var(--gray-600);
}

.audit-time {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.audit-entry-details {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.audit-expand-btn {
    font-size: 0.7rem;
    color: var(--primary-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.audit-expand-btn:hover {
    text-decoration: underline;
}

.audit-full-details {
    margin-top: 0.5rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 0.5rem;
    overflow-x: auto;
}

.audit-full-details pre {
    font-size: 0.7rem;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.audit-log-stats {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--gray-600);
}

.audit-stats-summary {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Snapshots */
.snapshot-list {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
}

.snapshot-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.snapshot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.snapshot-reason {
    font-weight: 600;
    color: var(--gray-800);
}

.snapshot-time {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.snapshot-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

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

.snapshot-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--gray-600);
}

.snapshot-info p {
    margin: 0.25rem 0;
}

/* Backup Styles */
.backup-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #92400e;
}

.backup-list {
    max-height: 300px;
    overflow-y: auto;
}

.backup-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.875rem;
    margin-bottom: 0.5rem;
}

.backup-card.latest {
    border-color: var(--success-color);
    background: linear-gradient(90deg, var(--success-light), white 30%);
}

.backup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.backup-date {
    font-weight: 600;
    color: var(--gray-800);
}

.backup-badge {
    background: var(--success-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.backup-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}

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

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
}

/* System Info */
.system-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.system-info-item {
    background: var(--gray-50);
    padding: 0.75rem;
    border-radius: var(--radius);
}

.system-info-item label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.system-info-item span {
    font-size: 0.9rem;
    color: var(--gray-800);
    font-weight: 500;
}

.storage-info {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: var(--radius);
}

.storage-info h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--gray-700);
}

.storage-bar-container {
    margin-bottom: 0.75rem;
}

.storage-bar {
    display: flex;
    height: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--gray-200);
}

.storage-segment {
    transition: width 0.3s;
}

.storage-segment.guests {
    background: var(--primary-color);
}

.storage-segment.audit {
    background: var(--warning-color);
}

.storage-segment.snapshots {
    background: var(--success-color);
}

.storage-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.guests {
    background: var(--primary-color);
}

.legend-color.audit {
    background: var(--warning-color);
}

.legend-color.snapshots {
    background: var(--success-color);
}

.storage-total {
    font-size: 0.85rem;
    color: var(--gray-700);
}

/* Print Styles */
@media print {
    .header {
        background: none;
        color: black;
        box-shadow: none;
    }

    .search-section,
    .action-buttons,
    .guest-actions,
    .modal,
    .toast {
        display: none !important;
    }

    .guest-card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}
