/* ═══════════════════════════════════════════════════════════════
   BananaSohbet — UI Components
   ═══════════════════════════════════════════════════════════════ */

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.btn:hover::after {
    opacity: 0.05;
}
.btn:active::after {
    opacity: 0.1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}
.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.btn-ghost {
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--fs-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--fs-md);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ─── Inputs ──────────────────────────────────────────────────── */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.input-group label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--bg-surface);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--fs-base);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.input::placeholder {
    color: var(--text-muted);
}

.input-error {
    border-color: var(--danger) !important;
}

.error-text {
    color: var(--danger);
    font-size: var(--fs-xs);
    margin-top: var(--space-1);
}

/* ─── Avatar ──────────────────────────────────────────────────── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--fw-semibold);
    font-size: var(--fs-sm);
    color: white;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--fs-xs);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--fs-lg);
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: var(--fs-2xl);
}

/* Online indicator */
.avatar .status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    border: 2.5px solid var(--bg-secondary);
    background: var(--offline);
}

.avatar .status-dot.online {
    background: var(--online);
}

/* ─── Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    width: min(480px, 90vw);
    box-shadow: var(--glass-shadow);
    animation: slideUp 0.3s ease;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.modal-title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    font-size: var(--fs-lg);
}
.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

/* ─── Toast Notifications ─────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: var(--fs-sm);
    box-shadow: var(--glass-shadow);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 380px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

/* ─── Context Menu ────────────────────────────────────────────── */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-1);
    box-shadow: var(--glass-shadow);
    z-index: var(--z-modal);
    min-width: 180px;
    animation: scaleIn 0.15s ease;
}

.context-menu-item {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.context-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.context-menu-separator {
    height: 1px;
    background: var(--bg-surface);
    margin: var(--space-1) 0;
}

/* ─── Tooltip ─────────────────────────────────────────────────── */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-darkest);
    color: var(--text-primary);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 50;
}
[data-tooltip]:hover::after {
    opacity: 1;
}

/* ─── Divider ─────────────────────────────────────────────────── */
.divider {
    width: 100%;
    height: 1px;
    background: var(--bg-surface);
    margin: var(--space-2) 0;
}

/* ─── Badge ───────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--fw-bold);
    background: var(--danger);
    color: white;
}

/* ─── Spinner ─────────────────────────────────────────────────── */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--bg-surface);
    border-top-color: var(--primary-500);
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
}

/* ─── Animations ──────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}
