/**
 * RIFT v2 - UI Components
 * Toasts, Skeletons, Cards, Button States
 */

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    bottom: 100px;
    left: 96px; /* Sidebar (72px) + Abstand (24px) */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 340px;
    position: relative;
    overflow: hidden;
}

/* Hide any duplicate checkmarks */
.toast__icon svg + svg {
    display: none;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.hide {
    transform: translateY(100px);
    opacity: 0;
}

.toast__icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast__icon svg {
    width: 20px;
    height: 20px;
}

.toast__content {
    flex: 1;
    min-width: 0;
}

.toast__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.toast__message {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.toast__close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.toast__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.toast__close svg {
    width: 16px;
    height: 16px;
}

/* Toast Progress Bar */
.toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 14px 14px;
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Toast Variants */
.toast--success {
    border-color: rgba(34, 197, 94, 0.3);
}

.toast--success .toast__icon {
    color: #22c55e;
}

.toast--success .toast__progress {
    background: #22c55e;
}

.toast--error {
    border-color: rgba(255, 70, 85, 0.3);
}

.toast--error .toast__icon {
    color: var(--accent);
}

.toast--error .toast__progress {
    background: var(--accent);
}

.toast--warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.toast--warning .toast__icon {
    color: #f59e0b;
}

.toast--warning .toast__progress {
    background: #f59e0b;
}

.toast--info {
    border-color: rgba(59, 130, 246, 0.3);
}

.toast--info .toast__icon {
    color: #3b82f6;
}

.toast--info .toast__progress {
    background: #3b82f6;
}

/* ========================================
   SKELETON LOADING
   ======================================== */

.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 100%
    );
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes skeletonShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Skeleton Variants */
.skeleton--text {
    height: 16px;
    border-radius: 4px;
}

.skeleton--text-sm {
    height: 12px;
    border-radius: 3px;
}

.skeleton--text-lg {
    height: 24px;
    border-radius: 6px;
}

.skeleton--title {
    height: 32px;
    width: 60%;
    border-radius: 6px;
}

.skeleton--avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.skeleton--avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.skeleton--avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 16px;
}

.skeleton--button {
    height: 44px;
    border-radius: 12px;
}

.skeleton--card {
    height: 120px;
    border-radius: 16px;
}

.skeleton--image {
    aspect-ratio: 16/9;
    border-radius: 12px;
}

/* Skeleton Card Preset */
.skeleton-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.skeleton-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.skeleton-card__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ========================================
   GLASSMORPHISM CARDS
   ======================================== */

.glass-card {
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Inner glow effect */
.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        transparent 100%
    );
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Card Variants */
.glass-card--solid {
    background: rgba(30, 30, 30, 0.9);
}

.glass-card--subtle {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
}

.glass-card--accent {
    border-color: rgba(255, 70, 85, 0.2);
}

.glass-card--accent::before {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 70, 85, 0.2) 50%, 
        transparent 100%
    );
}

.glass-card--interactive {
    cursor: pointer;
}

.glass-card--interactive:hover {
    background: rgba(40, 40, 40, 0.7);
}

.glass-card--interactive:active {
    transform: translateY(0);
}

/* No hover variant */
.glass-card--static {
    cursor: default;
}

.glass-card--static:hover {
    transform: none;
    box-shadow: none;
}

/* Card Sizes */
.glass-card--sm {
    padding: 16px;
    border-radius: 14px;
}

.glass-card--lg {
    padding: 32px;
    border-radius: 24px;
}

/* Card Header */
.glass-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.glass-card__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
}

.glass-card__subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.glass-card__icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--red-dim);
    border-radius: 14px;
    color: var(--accent);
}

.glass-card__icon svg {
    width: 24px;
    height: 24px;
}

.glass-card__icon--blue {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.glass-card__icon--green {
    background: var(--green-dim);
    color: var(--success);
}

.glass-card__icon--purple {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

/* ========================================
   ENHANCED BUTTON STATES
   ======================================== */

.btn {
    position: relative;
    overflow: hidden;
}

/* Ripple Effect */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease, opacity 0.6s ease;
    opacity: 0;
}

.btn:active::after {
    width: 300px;
    height: 300px;
    opacity: 0;
    transition: 0s;
}

/* Loading State */
.btn--loading {
    color: transparent !important;
    pointer-events: none;
}

.btn--loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btnSpinner 0.8s linear infinite;
}

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

/* Success State */
.btn--success {
    background: #22c55e !important;
    border-color: #22c55e !important;
}

/* Icon Buttons */
.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    color: var(--text);
}

.btn-icon:active {
    transform: scale(0.95);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.btn-icon--sm {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.btn-icon--sm svg {
    width: 18px;
    height: 18px;
}

.btn-icon--lg {
    width: 52px;
    height: 52px;
    border-radius: 14px;
}

.btn-icon--lg svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   LOADING OVERLAY
   ======================================== */

.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 22, 22, 0.8);
    backdrop-filter: blur(4px);
    border-radius: inherit;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-spinner--sm {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.loading-spinner--lg {
    width: 56px;
    height: 56px;
    border-width: 4px;
}

/* ========================================
   EMPTY STATES
   ======================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state__icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    margin-bottom: 20px;
    color: var(--text-dim);
}

.empty-state__icon svg {
    width: 36px;
    height: 36px;
}

.empty-state__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state__message {
    font-size: 0.9375rem;
    color: var(--text-muted);
    max-width: 280px;
    line-height: 1.5;
}

.empty-state__action {
    margin-top: 24px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 80px;
    }
}

@media (max-width: 540px) {
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 80px;
    }
    
    .toast {
        max-width: 100%;
    }
    
    .glass-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .glass-card--lg {
        padding: 24px;
        border-radius: 20px;
    }
}
