/* 2-components.css @🍮 */

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}
.app-header .back-btn, .app-header .action-btn {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.app-header .action-btn-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.app-header .action-btn-group .action-btn {
    font-size: 16px;
    font-weight: 600;
    width: auto;
    padding: 6px 12px;
    border-radius: 10px;
}
.app-header .action-btn-group #create-group-btn {
    background-color: var(--primary-color);
    color: var(--white-color);
}
.app-header .action-btn-group #add-chat-btn {
    font-size: 28px;
    padding: 0;
    width: 40px;
    height: 40px;
    background-color: transparent;
    color: var(--primary-color);
    border-radius: 50%;
}
.app-header .action-btn img {
    width: 28px;
    height: 28px;
}
.app-header .title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.app-header .title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}
.app-header .subtitle {
    font-size: 12px;
    color: #888;
    display: flex;
    align-items: center;
    margin-top: 2px;
}
.online-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--online-status-color);
    margin-right: 5px;
}
.app-header .placeholder {
    width: 40px;
}
#cancel-multi-select-btn {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--white-color) !important;
    background-color: var(--primary-color) !important;
    border-radius: 10px !important;
    padding: 5px 10px !important;
    width: auto !important;
    height: auto !important;
}

/* --- Buttons --- */
.btn {
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}
.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
}
.btn-primary:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 4px 15px rgba(255, 128, 171, 0.5);
}
label.btn-primary {
    color: var(--white-color) !important;
}
.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
}
.btn-secondary {
    background-color: var(--accent-color);
    color: var(--white-color);
    margin-bottom: 15px;
}
.btn-secondary:hover {
    background-color: #64b5f6;
    box-shadow: 0 4px 15px rgba(144, 202, 249, 0.5);
}
.btn-neutral {
    background-color: #bdbdbd;
    color: var(--white-color);
}
.btn-neutral:hover {
    background-color: #9e9e9e;
}
.btn-danger {
    background-color: #ef5350;
    color: white;
}
.btn .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: var(--white-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.btn.loading .spinner {
    display: block;
}
.btn.loading .btn-text {
    display: none;
}

/* --- Modals & Overlays --- */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.modal-overlay.visible {
    display: flex;
}
.modal-window {
    background: var(--white-color);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    width: 85%;
    max-width: 340px;
    animation: slideUp 0.4s ease-out;
}
.modal-window h3 {
    margin-top: 0;
    text-align: center;
    color: var(--primary-color);
}
.action-sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    display: none;
    align-items: flex-end;
    animation: fadeIn 0.3s ease;
}
.action-sheet-overlay.visible {
    display: flex;
}
.action-sheet {
    background: #f7f7f7;
    width: 100%;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    animation: slideUp 0.3s ease-out;
}
.action-sheet-button {
    width: 100%;
    background: white;
    border: none;
    padding: 15px;
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px;
    margin-bottom: 8px;
}
.action-sheet-button.danger {
    color: #e53935;
}
.action-sheet-button:last-child {
    margin-bottom: 0;
}
.context-menu {
    position: fixed;
    z-index: 1000;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    padding: 5px 0;
    animation: fadeIn 0.1s ease;
}
.context-menu-item {
    padding: 10px 20px;
    cursor: pointer;
}
.context-menu-item:hover {
    background-color: #f5f5f5;
}
.context-menu-item.danger {
    color: #e53935;
}
.toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 15px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s, visibility 0.5s;
    z-index: 1000;
}
.toast.show {
    opacity: 1;
    visibility: visible;
}
#world-book-selection-modal, #invite-member-modal, #group-recipient-selection-modal, #edit-group-member-modal, #create-member-for-group-modal {
    z-index: 102;
}
#world-book-selection-modal .modal-window, #invite-member-modal .modal-window, #group-recipient-selection-modal .modal-window {
    width: 90%;
    max-width: 380px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--secondary-color);
    font-weight: 600;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #fce4ec;
    border-radius: 10px;
    background-color: #fff;
    transition: border-color 0.3s;
    font-family: var(--font-family);
    font-size: 14px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}
.form-group.radio-group {
    display: flex;
    gap: 20px;
    align-items: center;
}
.form-group.radio-group label {
    margin-bottom: 0;
}

/* --- Lists --- */
.list-container {
    list-style: none;
    margin: 0;
    padding: 0;
}
.list-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    position: relative;
}
.list-item:hover {
    background-color: #fdf6f8;
}
.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    flex-shrink: 0;
    background-color: #eee;
}
.group-avatar {
    border-radius: 10px;
}
.item-details {
    flex-grow: 1;
    overflow: hidden;
}
.item-details-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.item-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 16px;
}
.item-preview-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.item-preview {
    font-size: 14px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}
.pin-badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* --- Selection Lists (in Modals) --- */
#world-book-selection-list, #invite-member-selection-list, #group-recipient-selection-list, .member-selection-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 40vh;
    overflow-y: auto;
}
.world-book-select-item, .invite-member-select-item, .group-recipient-select-item, .member-selection-item {
    display: flex;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px solid #f0f0f0;
}
.world-book-select-item:last-child, .invite-member-select-item:last-child, .group-recipient-select-item:last-child, .member-selection-item:last-child {
    border-bottom: none;
}
.world-book-select-item input[type="checkbox"], .invite-member-select-item input[type="checkbox"], .group-recipient-select-item input[type="checkbox"], .member-selection-item input[type="checkbox"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.world-book-select-item label, .invite-member-select-item label, .group-recipient-select-item label {
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.invite-member-select-item img, .group-recipient-select-item img, .member-selection-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.member-selection-item label {
    font-weight: 500;
    color: var(--text-color);
}
.member-selection-item img {
    margin-right: 10px;
}
