/**
 * REGISTER SYSTEM STYLES
 * Uses same table classes as database forms
 */

/* =============================================
   TABLE VIEW - Register specific additions
   ============================================= */
.swp_sregister {
    padding: 10px;
    overflow-x: auto;
}

.swp_regth_name,
.swp_regtd_name {
    text-align: left !important;
    white-space: nowrap;
    font-weight: 500;
}

.swp_regth_id,
.swp_regtd_id {
    width: 50px;
    min-width: 50px;
    text-align: center !important;
}

.swp_regtd_id {
    color: #888;
    font-weight: 500;
}

.swp_regth_date {
    min-width: 90px;
    font-size: 12px;
    line-height: 1.3;
    position: relative;
    vertical-align: middle;
    padding: 8px 5px !important;
    white-space: nowrap;
}

.swp_regth_datetext {
    display: inline-block;
    font-weight: 600;
    margin-right: 3px;
}

.swp_regth_timetext {
    display: inline-block;
    font-size: 10px;
    color: #666;
    font-weight: normal;
    margin-right: 5px;
}

.swp_regth_actions {
    display: inline-block;
    white-space: nowrap;
}

.swp_regth_delete {
    color: #dc3545;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    font-size: 12px;
}

.swp_regth_delete:hover {
    opacity: 1;
}

.swp_regth_nodata {
    color: #888;
    font-style: italic;
    font-weight: normal;
}

.swp_regth_stats,
.swp_regtd_stats {
    min-width: 50px;
    text-align: center !important;
}

.swp_regtd_stats {
    font-weight: 600;
}

.swp_regtd_att {
    text-align: center !important;
    padding: 5px !important;
}

.swp_reg_present {
    background: #d4edda !important;
}

.swp_reg_absent {
    background: #fff !important;
}

.swp_regtd_nodata {
    text-align: center !important;
    color: #888;
}

/* =============================================
   FORM VIEW (Quick Entry)
   ============================================= */
.swp_regform_container {
    padding: 15px;
}

.swp_regform_inner {
    max-width: 600px;
}

.swp_regform_quick {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.swp_regform_grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 20px;
}

.swp_regform_member {
    display: block;
    padding: 14px 18px;
    margin: 6px 0;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.swp_regform_member:hover {
    background: #f0f0f0;
}

.swp_regform_member_inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.swp_regform_name {
    font-weight: 500;
}

.swp_regform_submit {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* =============================================
   MEMBERS TAB
   ============================================= */
.swp_reg_members_container {
    padding: 15px;
}

.swp_reg_members_list {
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.swp_reg_members_table {
    width: 100%;
}

.swp_reg_members_row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.swp_reg_members_row:last-child {
    border-bottom: none;
}

.swp_reg_members_header,
.swp_reg_members_row:first-child {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: #666;
}

.swp_reg_members_row:hover:not(.swp_reg_members_header):not(:first-child) {
    background: #fafafa;
}

.swp_reg_member_num {
    width: 40px;
    color: #888;
    font-weight: 500;
}

.swp_reg_member_name {
    flex: 1;
    min-width: 150px;
    font-weight: 500;
}

.swp_reg_member_email {
    flex: 1;
    min-width: 150px;
    color: #666;
    font-size: 14px;
}

.swp_reg_member_actions {
    width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.swp_reg_member_actions .la-pen {
    color: #007bff;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.swp_reg_member_actions .la-pen:hover {
    opacity: 1;
}

.swp_reg_member_actions .la-trash {
    color: #dc3545;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.swp_reg_member_actions .la-trash:hover {
    opacity: 1;
}

.swp_reg_edit_input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #007bff;
    border-radius: 4px;
    font-size: 14px;
}

.swp_reg_edit_input:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

.swp_reg_add_member {
    padding-top: 20px;
    margin-top: 10px;
    border-top: 1px solid #eee;
}

.swp_reg_add_member_row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.swp_reg_add_member_row .swp_input {
    flex: 1;
    min-width: 150px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.swp_reg_add_member_row .swp_input:focus {
    border-color: #007bff;
    outline: none;
}

.swp_reg_import_btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.swp_reg_empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-style: italic;
}

.swp_reg_empty_cell {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-style: italic;
}

/* =============================================
   REGISTER TABLE SORT & FILTER
   ============================================= */
.swp_regtable .swp_dbtheader {
    position: relative;
    vertical-align: middle;
    white-space: nowrap;
}

.swp_regtable .swp_dbtitle {
    display: inline-block;
    font-weight: 600;
    margin-right: 6px;
}

.swp_regtable .swp_dbfsort,
.swp_regtable .swp_dbfsorth {
    cursor: pointer;
    font-size: 14px;
    color: #bbb;
    padding: 2px;
    transition: color 0.2s;
    vertical-align: middle;
}

.swp_regtable .swp_dbfsort:hover,
.swp_regtable .swp_dbfsorth:hover {
    color: #333;
}

.swp_regtable .swp_dbfsort.active,
.swp_regtable .swp_dbfsorth.active {
    color: var(--accent1, #2a9d90);
}

.swp_regtable .swp_dbifilter {
    cursor: pointer;
    font-size: 14px;
    color: #bbb;
    padding: 2px;
    margin-left: 2px;
    transition: color 0.2s;
    vertical-align: middle;
}

.swp_regtable .swp_dbifilter:hover {
    color: #333;
}

.swp_regtable .swp_dbifilter.active {
    color: var(--accent1, #2a9d90);
}

.swp_regtable .swp_dbfilter {
    margin-top: 8px;
    position: relative;
}

.swp_regtable .swp_dbfilter_input {
    width: 100%;
    padding: 6px 28px 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.swp_regtable .swp_dbfilter_input:focus {
    outline: none;
    border-color: var(--accent1, #2a9d90);
}

.swp_regtable .swp_dbfilter_clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 14px;
}

.swp_regtable .swp_dbfilter_clear:hover {
    color: #dc3545;
}

/* Wider columns for sort/filter icons */
.swp_regth_id {
    min-width: 70px !important;
    width: 70px;
}

.swp_regth_name {
    min-width: 200px !important;
}

.swp_regth_stats {
    min-width: 80px !important;
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
    .swp_regth_delete {
        display: none !important;
    }

    .swp_toggle {
        display: none !important;
    }

    .swp_regtd_att:after {
        content: '✓';
        font-size: 16px;
    }

    .swp_reg_absent .swp_regtd_att:after {
        content: '';
    }

    .swp_reg_present {
        background: #d4edda !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* =============================================
   ADD DATE MODAL (swp_sig_modal style)
   ============================================= */
.swp_reg_modal_form {
    margin: 20px 0;
}

.swp_reg_modal_field {
    margin-bottom: 16px;
}

.swp_reg_modal_field:last-child {
    margin-bottom: 0;
}

.swp_reg_modal_label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.swp_reg_modal_input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.swp_reg_modal_input:focus {
    outline: none;
    border-color: var(--accent1, #2a9d90);
    box-shadow: 0 0 0 3px rgba(42, 157, 144, 0.1);
}

.swp_sig_modal_content h3 i {
    margin-right: 8px;
    color: var(--accent1, #2a9d90);
}

/* =============================================
   IMPORT USERS/GROUP MODAL
   ============================================= */
.swp_reg_import_modal {
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.swp_reg_import_desc {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

.swp_reg_import_list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 15px;
}

.swp_reg_import_selectall {
    padding: 12px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.swp_reg_import_item {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.swp_reg_import_item:last-child {
    border-bottom: none;
}

.swp_reg_import_item:hover:not(.swp_reg_import_disabled) {
    background: #f9f9f9;
}

.swp_reg_import_item label {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.swp_reg_import_disabled {
    opacity: 0.6;
    background: #f9f9f9;
}

.swp_reg_import_disabled label {
    cursor: default;
}

.swp_reg_import_name {
    font-weight: 500;
}

.swp_reg_import_email {
    color: #888;
    font-size: 13px;
}

.swp_reg_import_badge {
    font-size: 11px;
    background: #e0e0e0;
    color: #666;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Import options modal (radio + group filter) */
.swp_reg_import_options {
    margin: 10px 0;
}

.swp_reg_import_choice {
    margin-top: 10px;
}

.swp_reg_import_radio {
    display: block;
    padding: 10px 14px;
    margin: 6px 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.swp_reg_import_radio:hover {
    background: #f9f9f9;
    border-color: #ccc;
}

.swp_reg_import_radio input[type="radio"] {
    margin-right: 8px;
    vertical-align: middle;
}

.swp_reg_import_grouplist {
    margin: 8px 0 4px 28px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.swp_reg_import_grouplabel {
    display: block;
    padding: 6px 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
    border-radius: 4px;
}

.swp_reg_import_grouplabel:hover {
    background: #eef0f2;
}

.swp_reg_import_grouplabel input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
}

.swp_reg_import_item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.swp_reg_import_item input[type="checkbox"]:disabled {
    cursor: default;
}

/* =============================================
   ATTENDANCE NOTES
   ============================================= */

/* Note icon in table cells */
.swp_reg_att_cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.swp_reg_noteicon {
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s, opacity 0.2s;
    opacity: 0.5;
}

.swp_reg_noteicon:hover {
    color: #f0ad4e;
    opacity: 1;
}

.swp_reg_noteicon.has_note {
    color: #f0ad4e;
    opacity: 1;
}

/* Form view controls (toggle + note icon) */
.swp_regform_controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.swp_regform_controls .swp_reg_noteicon {
    font-size: 18px;
}

/* Note modal */
.swp_reg_note_modal_content {
    max-width: 450px;
}

.swp_reg_note_textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    font-size: 14px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-family: inherit;
    box-sizing: border-box;
}

.swp_reg_note_textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

/* Quick suggestion chips */
.swp_reg_note_suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.swp_reg_note_chip {
    display: inline-block;
    padding: 4px 12px;
    background: #f0f1f3;
    color: #555;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    user-select: none;
}

.swp_reg_note_chip:hover {
    background: #e2e6ea;
    color: #333;
}

/* =============================================
   FORM SEARCH/FILTER
   ============================================= */

.swp_regform_search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.swp_regform_search .la-search {
    color: #999;
    font-size: 18px;
}

.swp_regform_search input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
}

.swp_regform_search input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

.swp_regform_search_count {
    color: #888;
    font-size: 13px;
    white-space: nowrap;
}

/* =============================================
   PUBLIC ATTENDANCE - Centered Card Layout
   Structure: #swp_registerframe > h2.swp_public_title + #swp_sregister
   ============================================= */

#swp_registerframe {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
}

#swp_registerframe .swp_public_title {
    text-align: center;
    margin: 0;
    padding: 30px 30px 20px 30px;
    color: #1f2937;
    font-size: 24px;
    font-weight: 600;
    width: 100%;
    max-width: 600px;
    background: #ffffff;
    border-radius: 12px 12px 0 0;
    border: 1px solid #e5e7eb;
    border-bottom: 2px solid #f0f0f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

#swp_registerframe #swp_sregister,
#swp_registerframe .swp_sregister {
    width: 100%;
    max-width: 600px;
    background: #ffffff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 25px 30px 30px 30px;
    border: 1px solid #e5e7eb;
    border-top: none;
    box-sizing: border-box;
    overflow-x: auto;
}

/* Form fields inside register */
#swp_registerframe .swp_formfieldline {
    margin-bottom: 15px;
    text-align: left;
}

#swp_registerframe .swp_formfieldtitle {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

#swp_registerframe .swp_formfield input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

#swp_registerframe .swp_formfield input:focus {
    outline: none;
    border-color: var(--accent1, #2a9d90);
    box-shadow: 0 0 0 3px rgba(42, 157, 144, 0.15);
}

/* Member list styling */
#swp_registerframe .swp_regform_member {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 12px 16px;
}

#swp_registerframe .swp_regform_member:hover {
    background: #f3f4f6;
}

/* Quick action buttons - themed to match popup */
#swp_registerframe .swp_regform_quick {
    display: flex;
    gap: 10px;
    padding: 15px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

#swp_registerframe .swp_regform_quick .swp_save_button,
#swp_registerframe .swp_regform_quick .swp_close_button {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#swp_registerframe .swp_regform_quick .swp_save_button {
    background-color: var(--accent1, #2a9d90);
    color: #fff;
    border: 1px solid var(--accent1, #2a9d90);
}

#swp_registerframe .swp_regform_quick .swp_save_button:hover {
    background-color: var(--accent2, #238578);
    border-color: var(--accent2, #238578);
}

#swp_registerframe .swp_regform_quick .swp_close_button {
    background-color: #fff;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

#swp_registerframe .swp_regform_quick .swp_close_button:hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* Save attendance button - themed to match popup */
#swp_registerframe .swp_regform_submit .swp_save_button {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background-color: var(--accent1, #2a9d90);
    color: #fff;
    border: 1px solid var(--accent1, #2a9d90);
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    text-align: center;
    text-decoration: none;
}

#swp_registerframe .swp_regform_submit .swp_save_button:hover {
    background-color: var(--accent2, #238578);
    border-color: var(--accent2, #238578);
    transform: translateY(-1px);
}

/* Table view enhancements */
#swp_registerframe table {
    border-collapse: collapse;
    width: 100%;
    font-size: 14px;
}

#swp_registerframe th,
#swp_registerframe td {
    border: 1px solid #e5e7eb;
    padding: 10px 12px;
    text-align: left;
}

#swp_registerframe th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

#swp_registerframe tbody tr:hover {
    background: #f9fafb;
}

/* Responsive */
@media (max-width: 640px) {
    #swp_registerframe {
        padding: 20px 15px;
    }

    #swp_registerframe .swp_public_title {
        font-size: 20px;
        padding: 20px 15px 15px 15px;
        border-radius: 8px 8px 0 0;
    }

    #swp_registerframe #swp_sregister,
    #swp_registerframe .swp_sregister {
        padding: 20px 15px;
        border-radius: 0 0 8px 8px;
    }

    #swp_registerframe .swp_regform_quick {
        flex-direction: column;
    }
}

/* Print */
@media print {
    #swp_registerframe {
        padding: 0;
        background: none;
    }

    #swp_registerframe .swp_public_title,
    #swp_registerframe #swp_sregister,
    #swp_registerframe .swp_sregister {
        box-shadow: none;
        border: none;
        max-width: 100%;
        border-radius: 0;
    }
}