/**
 * Reusable Components
 * Buttons, cards, tables, pagination, etc.
 */

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-large {
    padding: 12px 32px;
    font-size: 16px;
}

.btn-full-width {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-primary {
    background: #0071e3;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0077ed;
}

.btn-secondary {
    background: #86868b;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #6e6e73;
}

.btn-danger {
    background: #ff3b30;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #ff453a;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* Stats Widget */
.stats-widget {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #0071e3;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: #86868b;
    text-transform: capitalize;
}

/* Legacy stats class for backward compatibility */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Tables */
.table-container {
    background: var(--bg-surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-primary);
    transition: background-color var(--transition-normal);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: color var(--transition-normal), border-color var(--transition-normal);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-primary);
    transition: color var(--transition-normal), border-color var(--transition-normal);
}

tbody tr:hover {
    background: var(--bg-surface-hover);
    transition: background-color var(--transition-fast);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    margin-top: 20px;
    box-shadow: var(--shadow-md);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

.pagination-btn {
    padding: 8px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Search Input */
.search-input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

/* Filters */
.filters-section {
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Actions Bar */
.actions-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-surface);
    border-radius: 12px;
    align-items: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* Checkboxes */
.member-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Status Badges */
.status-active {
    color: #28a745;
    font-weight: 500;
}

.status-inactive {
    color: #dc3545;
    font-weight: 500;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 16px;
}

.page-header p {
    color: #86868b;
    font-size: 14px;
}

/* Page header with actions */
.page-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.page-header-with-actions h1 {
    margin: 0;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-hide {
    opacity: 0;
    transform: translateX(400px);
}

.toast-icon {
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: #1d1d1f;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #86868b;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: #f5f5f7;
    color: #1d1d1f;
}

.toast-success .toast-icon {
    background: #28a745;
    color: white;
}

.toast-error .toast-icon {
    background: #ff3b30;
    color: white;
}

.toast-warning .toast-icon {
    background: #ff9500;
    color: white;
}

.toast-info .toast-icon {
    background: #0071e3;
    color: white;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-container {
    background: var(--bg-surface);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.modal-content {
    padding: 24px;
}

@media (max-width: 768px) {
    .toast-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }
    
    .toast {
        transform: translateY(-100px);
    }
    
    .toast-show {
        transform: translateY(0);
    }
    
    .toast-hide {
        transform: translateY(-100px);
    }
    
    .modal-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}
