* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Safari-specific fixes */
html {
    -webkit-text-size-adjust: 100%;
}

input,
textarea,
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

:root {
    --primary-blue: #3D4A59;
    --dark-blue: #2B3843;
    --navy: #1E2A35;
    --light-gray: #F5F5F5;
    --medium-gray: #A0A0A0;
    --text-gray: #6C757D;
    --border-gray: #E8E8E8;
    --white: #FFFFFF;
    --red: #DC2626;
    --green: #10B981;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--white);
    color: var(--navy);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    /* iOS safe area support */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

\n html {
    height: -webkit-fill-available;
}

/* Header */
header {
    background: linear-gradient(to bottom, #414042 0%, #414042 70%, rgba(65, 64, 66, 0.95) 100%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: #F4B942;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    height: 50px;
    width: auto;
}

.hamburger-btn {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    opacity: 0.7;
}

.hamburger-btn span {
    display: block;
    height: 2.5px;
    background: var(--white);
    border-radius: 0;
    transition: all 0.3s ease;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 2rem;
    background: linear-gradient(180deg, #FAFAFA 0%, #F5F5F5 100%);
    position: relative;
    overflow: auto;
    min-height: calc(100vh - 78px);
}

/* Background image with fade */
main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        url('https://res.cloudinary.com/digjsdron/image/upload/v1759911309/Bible-Study_960x640_tmqwoq.jpg') center center / cover no-repeat;
    opacity: 0.19;
    pointer-events: none;
    z-index: 0;
}

/* Overlay to ensure readability */
main::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(245, 245, 245, 0.6) 100%);
    pointer-events: none;
    z-index: 0;
}

.welcome-container {
    max-width: 600px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 1;
    margin-top: 10vh;
}

.welcome-container h1 {
    font-size: 3rem;
    font-weight: 800;
    color: #2B3843;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.welcome-container .subtitle {
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--medium-gray);
    margin-bottom: 3rem;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.checkin-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 2rem;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.checkin-form input {
    padding: 1.3rem 1.5rem;
    padding-right: 3rem;
    font-size: 1.05rem;
    border: 2px solid var(--border-gray);
    border-radius: 0;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--navy);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: 100%;
    text-align: center;
}

.input-clear-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: var(--medium-gray);
    color: var(--white);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.input-clear-btn:hover {
    opacity: 1;
    background: var(--primary-blue);
    transform: translateY(-50%) scale(1.1);
}

.checkin-form input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(61, 74, 89, 0.1), 0 4px 12px rgba(0, 0, 0, 0.12);
}

.checkin-form input::placeholder {
    color: var(--medium-gray);
}

.check-in-btn {
    background: #414042;
    color: var(--white);
    border: none;
    padding: 1.4rem 2rem;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(65, 64, 66, 0.3);
    text-transform: none;
    position: relative;
}

.check-in-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #F4B942;
}

.check-in-btn:hover {
    background: #2d2c2e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(65, 64, 66, 0.4);
}

.check-in-btn:active {
    transform: translateY(0);
}

/* iOS Safari button fix */
.check-in-btn,
.modal-btn,
.connect-printer-btn,
.export-data-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.check-in-btn:disabled {
    background: var(--border-gray);
    color: var(--medium-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Sidebar Footer - Printer Connection */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 2px solid var(--border-gray);
    background: var(--light-gray);
}

.export-data-btn {
    width: 100%;
    background: var(--green);
    color: var(--white);
    border: none;
    padding: 1.1rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.export-data-btn:hover {
    background: #0d9968;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.export-data-btn:active {
    transform: translateY(0);
}

.acquire-hardware-btn {
    width: 100%;
    background: #FF9800;
    color: var(--white);
    border: none;
    padding: 1.1rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.acquire-hardware-btn:hover {
    background: #F57C00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.acquire-hardware-btn:active {
    transform: translateY(0);
}

.printer-btn-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.connect-printer-btn {
    flex: 1;
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 1.1rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(61, 74, 89, 0.3);
}

.connect-printer-btn:hover {
    background: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(61, 74, 89, 0.4);
}

.connect-printer-btn:disabled {
    background: var(--border-gray);
    color: var(--medium-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.forget-printer-btn {
    width: 50px;
    background: var(--red);
    color: var(--white);
    border: none;
    padding: 0;
    font-size: 1.8rem;
    font-weight: 400;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    line-height: 1;
    display: none;
}

.forget-printer-btn.visible {
    display: block;
}

.forget-printer-btn:hover {
    background: #B71C1C;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.forget-printer-btn:active {
    transform: translateY(0);
}

.status-text {
    font-size: 0.85rem;
    color: var(--medium-gray);
    text-align: center;
    margin: 0;
}

.status-text.connected {
    color: var(--green);
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: var(--white);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 1.5rem;
    background: var(--primary-blue);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.close-btn:hover {
    transform: rotate(90deg);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.checkin-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkin-item {
    background: var(--light-gray);
    padding: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.checkin-item:hover {
    background: var(--white);
    border-color: var(--primary-blue);
    transform: translateX(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.checkin-item-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.25rem;
}

.checkin-item-email {
    font-size: 0.9rem;
    color: var(--charcoal);
    margin-bottom: 0.25rem;
}

.checkin-item-time {
    font-size: 0.8rem;
    color: var(--medium-gray);
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--medium-gray);
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.modal-content {
    cursor: default;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    cursor: default;
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--medium-gray);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--navy);
    transform: rotate(90deg);
}

.modal h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.5rem;
    padding-right: 2rem;
}

.modal-email {
    font-size: 1rem;
    color: var(--charcoal);
    margin-bottom: 0.5rem;
}

.modal-time {
    font-size: 0.9rem;
    color: var(--medium-gray);
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-btn {
    padding: 1.1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.modal-btn span {
    font-size: 1.2rem;
}

.reprint-btn {
    background: var(--primary-blue);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(61, 74, 89, 0.3);
}

.reprint-btn:hover {
    background: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(61, 74, 89, 0.4);
}

.uncheckin-btn {
    background: var(--white);
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.uncheckin-btn:hover {
    background: var(--primary-blue);
    color: var(--white);
}

.download-badge-btn {
    background: #FF9800;
    color: var(--white);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.download-badge-btn:hover {
    background: #F57C00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.edit-btn {
    background: var(--primary-blue);
    color: var(--white);
}

.edit-btn:hover {
    background: #0f5fa5;
    transform: translateY(-2px);
}

.delete-btn {
    background: var(--red);
    color: var(--white);
}

.delete-btn:hover {
    background: #B71C1C;
    transform: translateY(-2px);
}

.modal-edit-form {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--light-gray);
}

.modal-edit-form h3 {
    font-size: 1.2rem;
    color: var(--dark-gray);
    margin-bottom: 1.5rem;
}

.modal-edit-form .form-group {
    margin-bottom: 1rem;
}

.modal-edit-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark-gray);
    font-weight: 500;
    font-size: 0.9rem;
}

.modal-edit-form input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.modal-edit-form input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* Edit form button styles */
.modal-edit-form .modal-btn {
    color: var(--white) !important;
}

.modal-edit-form .modal-btn.disabled,
.modal-edit-form .modal-btn:disabled {
    background: var(--light-gray) !important;
    color: var(--medium-gray) !important;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none !important;
}

.modal-edit-form .modal-btn.disabled:hover,
.modal-edit-form .modal-btn:disabled:hover {
    background: var(--light-gray) !important;
    transform: none !important;
    box-shadow: none !important;
}

.export-only-btn {
    background: var(--green);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.export-only-btn:hover {
    background: #0d9968;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.export-clear-btn {
    background: #FF6B35;
    color: var(--white);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.export-clear-btn:hover {
    background: #E55A2B;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.connect-now-btn {
    background: var(--primary-blue);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(61, 74, 89, 0.3);
}

.connect-now-btn:hover {
    background: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(61, 74, 89, 0.4);
}

.checkin-no-print-btn {
    background: var(--green);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.checkin-no-print-btn:hover {
    background: #0d9968;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.cancel-checkin-btn {
    background: var(--white);
    color: var(--text-gray);
    border: 2px solid var(--border-gray);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cancel-checkin-btn:hover {
    background: var(--light-gray);
    border-color: var(--medium-gray);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Confirm state styling */
.modal-btn.confirm-state {
    animation: pulse 0.3s ease;
}

.reprint-btn.confirm-state {
    background: var(--dark-blue);
    box-shadow: 0 4px 16px rgba(61, 74, 89, 0.5);
}

.uncheckin-btn.confirm-state {
    background: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
    box-shadow: 0 4px 16px rgba(61, 74, 89, 0.5);
}

.delete-btn.confirm-state {
    background: #B71C1C;
    box-shadow: 0 4px 16px rgba(183, 28, 28, 0.6);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Branding */
.branding {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 50;
}

.branding a {
    text-decoration: none;
    color: var(--text-gray);
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.6;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.branding a:hover {
    opacity: 1;
    color: var(--primary-blue);
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-container h1 {
        font-size: 1.5rem;
    }

    .sidebar {
        width: 100%;
        right: -100%;
    }

    .logo {
        height: 40px;
    }

    header {
        padding: 0.75rem 1rem;
    }

    .branding {
        bottom: 0.5rem;
        left: 0.5rem;
    }

    .branding a {
        font-size: 0.7rem;
    }

    /* iOS specific adjustments */
    .modal-content {
        max-height: 80vh;
        max-height: calc(80vh - env(safe-area-inset-bottom));
    }

    .sidebar {
        height: 100vh;
        height: -webkit-fill-available;
    }
}

/* iOS Safari input zoom prevention */
@media screen and (max-width: 768px) {

    input,
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Hardware Modal Styles */
.hardware-modal-content {
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
}

.hardware-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hardware-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: var(--light-gray);
    border: 2px solid var(--border-gray);
    border-radius: 12px;
    text-decoration: none;
    color: var(--navy);
    transition: all 0.3s ease;
    cursor: pointer;
}

.hardware-item:hover {
    background: var(--white);
    border-color: #FF9800;
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.2);
}

.hardware-icon {
    font-size: 2.5rem;
    min-width: 60px;
    text-align: center;
}

.hardware-info {
    flex: 1;
}

.hardware-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.3rem;
}

.hardware-info p {
    font-size: 0.85rem;
    color: var(--text-gray);
    line-height: 1.4;
    margin: 0;
}

.hardware-arrow {
    font-size: 1.5rem;
    color: #FF9800;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.hardware-item:hover .hardware-arrow {
    transform: translateX(5px);
}

@media (max-width: 768px) {
    .hardware-modal-content {
        max-height: 75vh;
        padding: 1.5rem;
    }

    .hardware-item {
        padding: 1rem;
    }

    .hardware-icon {
        font-size: 2rem;
        min-width: 50px;
    }

    .hardware-info h3 {
        font-size: 1rem;
    }

    .hardware-info p {
        font-size: 0.8rem;
    }
}

/* Autocomplete Dropdown Styles */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 2px solid var(--primary-blue);
    border-top: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: -2px;
}

.autocomplete-item {
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-gray);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #f0f7ff;
}

.autocomplete-name {
    font-weight: 600;
    color: var(--navy);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.autocomplete-details {
    font-size: 0.85rem;
    color: var(--text-gray);
}

/* Autocomplete on mobile */
@media (max-width: 768px) {
    .autocomplete-dropdown {
        max-height: 200px;
    }

    .autocomplete-item {
        padding: 0.75rem 1rem;
    }

    .autocomplete-name {
        font-size: 0.95rem;
    }

    .autocomplete-details {
        font-size: 0.8rem;
    }
}