/**
 * Reusable Components - Garena Account Checker
 * Buttons, Cards, Forms, Tables, Modals, Alerts
 */

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.625rem 1.25rem;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: var(--border-width-thin) solid transparent;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Button Variants */
.btn-primary {
    background-color: var(--color-primary);
    color: var(--text-inverse);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
}

.btn-accent {
    background-color: var(--color-accent);
    color: var(--text-inverse);
}

.btn-accent:hover:not(:disabled) {
    background-color: var(--color-accent-hover);
}

.btn-success {
    background-color: var(--color-success);
    color: var(--text-inverse);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-primary);
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: var(--font-size-lg);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* === CARDS === */
.card {
    background-color: var(--bg-primary);
    border: var(--border-width-thin) solid var(--border-light);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: var(--spacing-lg);
    border-bottom: var(--border-width-thin) solid var(--border-light);
}

.card-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    padding: var(--spacing-lg);
    border-top: var(--border-width-thin) solid var(--border-light);
    background-color: var(--bg-secondary);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-base);
}

/* === FORMS === */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.form-label.required::after {
    content: ' *';
    color: var(--color-accent);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: var(--border-width-thin) solid var(--border-medium);
    border-radius: var(--border-radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-control:disabled {
    background-color: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-control.is-invalid {
    border-color: var(--color-error);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--color-error-light);
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-text {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.form-error {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--color-error);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

/* === TABLES === */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius-lg);
    border: var(--border-width-thin) solid var(--border-light);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-primary);
}

.table thead {
    background-color: var(--bg-tertiary);
}

.table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    border-bottom: var(--border-width-medium) solid var(--border-medium);
}

.table td {
    padding: 0.875rem 1rem;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    border-bottom: var(--border-width-thin) solid var(--border-light);
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-striped tbody tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

/* Table Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--border-radius-full);
}

.status-success {
    background-color: var(--color-success-light);
    color: var(--color-success);
}

.status-error {
    background-color: var(--color-error-light);
    color: var(--color-error);
}

.status-warning {
    background-color: var(--color-warning-light);
    color: var(--color-warning);
}

.status-info {
    background-color: var(--color-info-light);
    color: var(--color-info);
}

/* === ALERTS === */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    border: var(--border-width-thin) solid;
    margin-bottom: var(--spacing-md);
}

.alert-success {
    background-color: var(--color-success-light);
    border-color: var(--color-success);
    color: var(--color-success);
}

.alert-error {
    background-color: var(--color-error-light);
    border-color: var(--color-error);
    color: var(--color-error);
}

.alert-warning {
    background-color: var(--color-warning-light);
    border-color: var(--color-warning);
    color: var(--color-warning);
}

.alert-info {
    background-color: var(--color-info-light);
    border-color: var(--color-info);
    color: var(--color-info);
}

.alert-title {
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-xs);
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--border-radius-full);
    background-color: var(--color-gray-200);
    color: var(--text-primary);
}

.badge-primary {
    background-color: var(--color-primary);
    color: var(--text-inverse);
}

.badge-accent {
    background-color: var(--color-accent);
    color: var(--text-inverse);
}

.badge-success {
    background-color: var(--color-success);
    color: var(--text-inverse);
}

/* === PROGRESS BAR === */
.progress {
    width: 100%;
    height: 1.5rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: width var(--transition-base);
}

.progress-bar-accent {
    background-color: var(--color-accent);
}

.progress-bar-success {
    background-color: var(--color-success);
}

/* === MODALS === */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    display: none;
}

.modal-backdrop.show {
    display: block;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    display: none;
}

.modal.show {
    display: block;
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: var(--border-width-thin) solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    padding: var(--spacing-lg);
    border-top: var(--border-width-thin) solid var(--border-light);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

/* === LOADING SPINNER === */
.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid var(--border-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

.spinner-lg {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 4px;
}

/* === PAGINATION === */
.pagination {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.pagination-item {
    padding: 0.5rem 0.75rem;
    border: var(--border-width-thin) solid var(--border-medium);
    border-radius: var(--border-radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
}

.pagination-item:hover {
    background-color: var(--bg-tertiary);
}

.pagination-item.active {
    background-color: var(--color-primary);
    color: var(--text-inverse);
    border-color: var(--color-primary);
}

.pagination-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === DROPDOWN === */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--spacing-xs);
    background-color: var(--bg-primary);
    border: var(--border-width-thin) solid var(--border-light);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: var(--z-dropdown);
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--bg-secondary);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-light);
    margin: var(--spacing-xs) 0;
}

/* === STATS CARD === */
.stat-card {
    background-color: var(--bg-primary);
    border: var(--border-width-thin) solid var(--border-light);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.stat-change {
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-xs);
}

.stat-change.positive {
    color: var(--color-success);
}

.stat-change.negative {
    color: var(--color-error);
}