/* Manager App Styles */
body {
    font-family: system-ui, Segoe UI, Roboto, Arial;
    background: #f4f7fa;
    margin: 0;
    padding: 0;
}

.manager-main {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

h1 {
    text-align: center;
    color: #256029;
    font-size: 2.1rem;
}

/* Dashboard Cards */
.dashboard {
    max-width: 900px;
    margin: 2rem auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
    padding: 1.5rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: box-shadow 0.2s, transform 0.2s;
    border: 1px solid #e6e9e8;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #c2e7d9;
    transform: translateY(-2px);
}

.card-icon {
    font-size: 2.2rem;
    margin-bottom: 0.7rem;
    color: #256029;
}

.card-icon img {
    width: 48px;
    height: 48px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #17202a;
}

.card-desc {
    font-size: 1rem;
    color: #6b6f72;
    margin-bottom: 0;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e6e9e8;
    margin-bottom: 2rem;
}

.tab {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #6b6f72;
    transition: all 0.2s;
}

.tab:hover {
    color: #256029;
    background: rgba(37, 96, 41, 0.05);
}

.tab.active {
    color: #256029;
    border-bottom-color: #256029;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* User List */
.user-list {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
    border: 1px solid #e6e9e8;
    overflow: hidden;
}

.user-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e6e9e8;
}

.user-list-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: #17202a;
}

.user-item {
    display: grid;
    grid-template-columns: 2fr 2fr 3fr 2fr 100px;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f4f7fa;
    cursor: pointer;
    transition: background 0.2s;
    align-items: center;
}

.user-item:hover {
    background: #f4f7fa;
}

.user-item:last-child {
    border-bottom: none;
}

.user-field {
    font-size: 0.95rem;
}

.user-field strong {
    font-weight: 600;
    color: #17202a;
}

.user-field.secondary {
    color: #6b6f72;
}

.user-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.user-status.active {
    background: #d4edda;
    color: #155724;
}

.user-status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.user-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.user-status.active .user-status-dot {
    background: #28a745;
}

.user-status.inactive .user-status-dot {
    background: #dc3545;
}

/* Invite Status Badges */
.invite-status {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.invite-status.pending {
    background: #fff3cd;
    color: #856404;
}

.invite-status.used {
    background: #d4edda;
    color: #155724;
}

.invite-status.expired {
    background: #f8d7da;
    color: #721c24;
}

/* Invite item with 5 columns */
.invite-item {
    grid-template-columns: 2fr 1fr 1.5fr 1.5fr 1.5fr;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #e6e9e8;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #256029;
    color: #fff;
    border-color: #256029;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    color: #6b6f72;
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    padding: 0.7rem 1.5rem;
    background: #256029;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn:hover {
    background: #1d4821;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 96, 41, 0.3);
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem 1rem;
    outline: none;
}

.modal.active {
    display: flex;
    align-items: center;
    /* Center vertically */
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 800px;
    max-height: calc(100vh - 70px);
    /* Leave room at top and bottom */
    margin: 0 auto;
    margin-top: 28px;
    /* Push down below topbar */
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e6e9e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: #17202a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b6f72;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f4f7fa;
    color: #17202a;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
    flex-shrink: 1;
    /* Allow shrinking */
    min-height: 0;
    /* Important for flexbox scrolling */
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e6e9e8;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #17202a;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #e6e9e8;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #256029;
}

.form-group small {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: #6b6f72;
}

.info-display {
    padding: 0.7rem;
    background: #f4f7fa;
    border: 1px solid #e6e9e8;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #17202a;
}

.error-text {
    color: #e74c3c;
    font-weight: 500;
}

.invite-url-container {
    display: flex;
    gap: 0.5rem;
}

.invite-url-container input {
    flex: 1;
}

.invite-url-container .btn {
    white-space: nowrap;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-group {
    margin-bottom: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.checkbox-group label:hover {
    background: #f4f7fa;
}

.checkbox-group input[type="checkbox"] {
    cursor: pointer;
}

/* Role/Permission Lists */
.role-permission-list {
    border: 1px solid #e6e9e8;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b6f72;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Invite UI Styles */
.invite-url-container {
    display: flex;
    gap: 0.5rem;
}

.invite-url-container input {
    flex: 1;
}

.invite-url-container .btn {
    white-space: nowrap;
}

.invite-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.invite-status.pending {
    background: #fff3cd;
    color: #856404;
}

.invite-status.used {
    background: #d4edda;
    color: #155724;
}

.invite-status.expired {
    background: #f8d7da;
    color: #721c24;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .manager-main {
        padding: 1rem;
    }

    .dashboard {
        padding: 1rem;
        gap: 1rem;
    }

    .user-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .tabs {
        overflow-x: auto;
    }

    .tab {
        white-space: nowrap;
    }

    .form-group-row {
        grid-template-columns: 1fr;
    }
}

/* System Utilities Styles */
.utilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.utility-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.utility-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
}

.utility-card p {
    margin: 0 0 1rem 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.utility-card .btn {
    background: white;
    color: #667eea;
    width: 100%;
    font-weight: 600;
}

.utility-card .btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.utility-card .btn:disabled {
    background: rgba(255, 255, 255, 0.5);
    color: rgba(102, 126, 234, 0.6);
    cursor: not-allowed;
}

#script-output-container {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#script-output {
    line-height: 1.5;
}

#script-output.success {
    border-left: 4px solid #2ecc71;
}

#script-output.error {
    border-left: 4px solid #e74c3c;
}

#script-output.running {
    border-left: 4px solid #3498db;
}