/* ==========================================================
   1. PAGE LAYOUT
   ========================================================== */

.page-container {
    padding: 20px;
    margin: 0 auto;
    max-width: 1200px;
    box-sizing: border-box;
}

/* ==========================================================
   2. PAGE HEADER
   ========================================================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.page-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.group-description {
    margin-top: 4px;
    font-size: 13px;
    color: #666;
}

/* ==========================================================
   3. HEADER ACTIONS (RIGHT SIDE)
   ========================================================== */

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.back-link {
    font-size: 13px;
    color: #555;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.header-buttons {
    display: flex;
    gap: 8px;
}

.header-buttons .primary-btn {
    height: 24px;
    padding: 4px 10px;
    font-size: 14px;
}

/* ==========================================================
   4. GROUP TITLE + ACTION MENU
   ========================================================== */

.group-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.group-menu {
    position: relative;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0 8px;
}

.group-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.group-menu-dropdown button {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
}

.group-menu-dropdown button:hover {
    background: #f5f5f5;
}

.group-menu-dropdown button.danger {
    color: #c0392b;
}

/* ==========================================================
   5. GROUP META
   ========================================================== */

.group-meta {
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

/* ==========================================================
   6. TABLE + EMPTY STATE
   ========================================================== */

.table-wrapper {
    margin-top: 8px;
}

.table-wrapper .empty-state {
    padding: 24px 0;
    font-size: 14px;
    color: #555;
}

.empty-state {
    text-align: center;
    padding: 16px;
    color: #777;
    font-style: italic;
}

/* ==========================================================
   7. TABLE STYLING
   ========================================================== */

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: #3a3a3a;
    color: #ffffff;
    font-weight: 600;
}

.admin-table th {
    padding: 8px 10px;
    text-align: left;
    vertical-align: middle;
}

.admin-table th:nth-child(1) {
    width: 300px;
}

.admin-table td {
    padding: 8px 10px;
    vertical-align: middle;
}

#groupMembersTable tbody tr:nth-child(even) {
    background-color: #f7f7f7;
}

#groupMembersTable tbody tr:hover {
    background-color: #f2f2f2;
}

/* ==========================================================
   8. FOOTER ACTIONS
   ========================================================== */

.footer-separator {
    margin: 16px 0 12px;
    border-top: 1px solid #e5e5e5;
}

.group-footer-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.group-footer-actions .danger-btn {
    font-size: 13px;
    padding: 6px 10px;
}

/* ==========================================================
   9. BUTTON BASE STYLES
   ========================================================== */

.primary-btn,
.secondary-btn {
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
}

/* Anchor buttons should look like buttons */
a.primary-btn,
a.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
}

/* ==========================================================
   10. BUTTON VARIANTS
   ========================================================== */

.primary-btn {
    background: #ffffff;
    border: 1px solid #ccc;
}

.primary-btn:not(:disabled):hover {
    background: #f6f7f8;
    border-color: #999;
}

.secondary-btn {
    background: #e0e0e0;
    border: 1px solid #ccc;
}

.secondary-btn:not(:disabled):hover {
    background: #d0d0d0;
}

/* Destructive actions */
.danger-btn {
    color: #a94442;
    background: #fdecea;
    border: 1px solid #f5c6cb;
    font-size: 12px;
    line-height: 1.4;
}

.danger-btn:not(:disabled):hover {
    background: #f8d7da;
    border-color: #e4b1b8;
}

/* Inline remove button */
.remove-btn {
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 4px;
    border: 1px solid #d9534f;
    background: #fff;
    color: #d9534f;
    cursor: pointer;
}

.remove-btn:hover {
    background: #fbeaea;
}

/* ==========================================================
   11. DISABLED STATES
   ========================================================== */

.primary-btn:disabled,
.secondary-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background-color: #e5e5e5;
    border-color: #ccc;
    color: #777;
}

/* ==========================================================
   12. UTILITIES
   ========================================================== */

.hidden {
    display: none !important;
}

/* ==========================================================
   MODAL BASE STYLES
========================================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 20px;
    width: 400px;
    border-radius: 6px;
}

.modal-lg {
    max-width: 600px;
}

/* ==========================================================
   MODAL FORMS
========================================================== */

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    margin-top: 6px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* ==========================================================
   MODAL ACTIONS
========================================================== */

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-content .form-error {
    margin-right: auto;
    padding: 6px 10px;
    font-size: 13px;
    color: #a50e0e;
    background: #fdecea;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    line-height: 1.4;
}