/* Base Modal Styles */
.attendance-base {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.attendance-popup-content {
    background-color: #F9FAFB;
    width: 95%;
    max-width: 1200px;
    height: 90%;
    max-height: 900px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.attendance-guide-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background-color: white;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.attendance-guide-panel.open {
    transform: translateX(0);
}

/* Guide Content Styles */
.attendance-guide-panel .modal-card {
    box-shadow: none;
    width: 100%;
    height: auto;
    padding: 0;
    border-radius: 0;
}

.attendance-guide-panel .modal-hd {
    padding: 20px 24px;
    background-color: #fff;
    border-bottom: 1px solid #E5E7EB;
}

.attendance-guide-panel .modal-bd {
    padding: 24px;
}

.attendance-guide-panel h2 {
    font-size: 20px;
    margin: 0;
}

.attendance-guide-panel .x {
    display: block !important;
    /* Ensure close button shows here */
}

.attendance-guide-panel .modal-hd .x,
.attendance-guide-panel .modal-ft {
    display: none;
    /* Hide default modal header close and footer in side panel */
}

.attendance-guide-panel h2 {
    font-size: 20px;
    margin-top: 0;
}

/* Header */
.attendance-header {
    background-color: #FFFFFF;
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
    z-index: 10;
}

.attendance-header h2 {
    margin: 8px 0 4px;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.attendance-header p {
    margin: 0 0 16px;
    color: #6B7280;
    font-size: 14px;
}

.header-buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #D1D5DB;
    background-color: white;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s;
}

.btn:hover {
    background-color: #F3F4F6;
    border-color: #9CA3AF;
}

/* Search Input */
.filter-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

#filter-input {
    padding: 10px 16px 10px 42px;
    font-size: 14px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    outline: none;
    background-color: #F9FAFB;
    transition: all 0.2s;
    box-sizing: border-box;
    width: 260px;
}

#filter-care-group {
    height: 40px;
    margin: 0;
    min-width: 160px;
}

#filter-input:focus {
    background-color: #FFFFFF;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Results Area */
.attendance-results {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

#results-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 40px;
}

/* Group Headers */
.result-header {
    grid-column: 1 / -1;
    font-size: 13px;
    font-weight: 700;
    color: #6B7280;
    margin: 12px 0 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 4px;
    border-bottom: 1px solid #E5E7EB;
}

/* Resident Card */
.resident-card {
    background-color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
    border: 1.5px solid #E5E7EB;
    overflow: hidden;
    width: 100%;
}

.resident-card:hover {
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
    border-color: #C7D2FE;
}

.resident-card.attending-card {
    border-color: #10B981;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
}

.resident-card.attending-card:hover {
    border-color: #059669;
}

.resident-card-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 14px 20px;
    text-align: left;
    gap: 16px;
}

.resident-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 1px #E5E7EB, 0 2px 8px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.resident-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    width: 100%;
    flex: 1;
}

.resident-name {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.resident-room {
    font-size: 12px;
    color: #6B7280;
    background-color: #F3F4F6;
    padding: 2px 10px;
    border-radius: 9999px;
}

.resident-note-text {
    font-size: 12px;
    color: #4B5563;
    font-style: italic;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.resident-actions {
    width: auto;
    flex-shrink: 0;
}

/* Action Button */
.btn-check-in {
    width: auto;
    padding: 8px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background-color: #4F46E5;
    color: white;
    transition: all 0.2s;
}

.btn-check-in:hover {
    background-color: #4338CA;
}

.btn-check-in.btn-remove {
    background-color: transparent;
    color: #EF4444;
    /* Red 500 */
    border: 1px solid #FECACA;
}

.btn-check-in.btn-remove:hover {
    background-color: #FEF2F2;
    border-color: #EF4444;
}

/* Engagement Panel */
.engagement-wrapper {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background-color: rgba(255, 255, 255, 0.5);
    animation: slideDown 0.2s ease-out;
    display: flex;
    flex-direction: column;
}

.engagement-container {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.note-section {
    padding: 0 16px 12px;
    display: flex;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.note-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.note-input:focus {
    border-color: #4F46E5;
}

.btn-save-note {
    padding: 8px 16px;
    background-color: #4F46E5;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}

.btn-save-note:hover {
    background-color: #4338CA;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.engagement-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.engagement-option {
    padding: 4px 10px;
    height: auto;
    border-radius: 9999px;
    border: 1px solid #D1D5DB;
    background-color: white;
    font-size: 12px;
    font-weight: 500;
    color: #4B5563;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.engagement-option:hover {
    border-color: #9CA3AF;
    background-color: #F3F4F6;
}

.engagement-option.selected {
    background-color: #10B981;
    /* Emerald 500 */
    color: white;
    border-color: #10B981;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

/* Special styles for specific options if needed */
.engagement-option[eors-value="r"].selected {
    background-color: #EF4444;
    border-color: #EF4444;
}

/* Refused - Red */
.engagement-option[eors-value="s"].selected {
    background-color: #8B5CF6;
    border-color: #8B5CF6;
}

/* Sleeping - Purple */
.engagement-option[eors-value="n"].selected {
    background-color: #6B7280;
    border-color: #6B7280;
}

/* Not in community - Gray */
.engagement-option[eors-value="rv"].selected {
    background-color: #3B82F6;
    border-color: #3B82F6;
}

.btn-note {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: transparent;
    color: #6B7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-note:hover {
    background-color: #F3F4F6;
    color: #111827;
}

/* Responsive Breakpoints */
@media screen and (max-width: 600px) {
    .attendance-popup-content {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
}