/**
 * Shared CSS - Portfolio Seyyid Sahin
 * Toast-System, Mobile-Warnungen, Leaderboard, A11y, Error-Boundary
 */

/* ============================================================
   TOAST NOTIFICATION SYSTEM
   ============================================================ */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 420px;
    width: calc(100% - 2rem);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
    font-size: 0.9rem;
    line-height: 1.4;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.toast-visible {
    transform: translateX(0);
    opacity: 1;
}

.toast-hiding {
    transform: translateX(120%);
    opacity: 0;
}

.toast-success {
    background: rgba(16, 185, 129, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-error {
    background: rgba(239, 68, 68, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-warning {
    background: rgba(245, 158, 11, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-info {
    background: rgba(59, 130, 246, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-message {
    flex: 1;
    font-weight: 500;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0 0.25rem;
    line-height: 1;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

/* ============================================================
   MOBILE WARNING OVERLAY
   ============================================================ */
.mobile-warning-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.mobile-warning-card {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.mobile-warning-icon {
    color: #f59e0b;
    margin-bottom: 1.5rem;
}

.mobile-warning-card h2 {
    color: #f1f5f9;
    font-size: 1.375rem;
    margin: 0 0 0.75rem;
    font-weight: 700;
}

.mobile-warning-card p {
    color: #94a3b8;
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

.mobile-warning-reason {
    color: #64748b !important;
    font-size: 0.85rem !important;
    margin-bottom: 1.5rem !important;
}

.mobile-warning-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.mobile-warning-actions .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.mobile-warning-actions .btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
}

.mobile-warning-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.mobile-warning-actions .btn-secondary:hover {
    background: rgba(148, 163, 184, 0.1);
    color: #e2e8f0;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.leaderboard-table thead th {
    background: rgba(59, 130, 246, 0.1);
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.leaderboard-table thead th:first-child {
    border-radius: 8px 0 0 0;
    text-align: center;
    width: 3rem;
}

.leaderboard-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.leaderboard-table tbody tr {
    transition: background 0.15s;
}

.leaderboard-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.leaderboard-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
    color: #e2e8f0;
}

.leaderboard-rank {
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
}

.leaderboard-name {
    font-weight: 600;
}

.leaderboard-score {
    font-weight: 700;
    color: #3b82f6;
    font-variant-numeric: tabular-nums;
}

.leaderboard-level {
    color: #94a3b8;
}

.leaderboard-top3 .leaderboard-name {
    color: #fbbf24;
}

.leaderboard-highlight {
    background: rgba(59, 130, 246, 0.12) !important;
    position: relative;
}

.leaderboard-highlight::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #3b82f6;
    border-radius: 0 3px 3px 0;
}

.leaderboard-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #64748b;
    font-style: italic;
}

/* ============================================================
   A11Y: SCREEN READER ONLY
   ============================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================================
   SHARED BACK BUTTON
   ============================================================ */
.back-to-portfolio {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.back-to-portfolio:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.1);
}

.back-to-portfolio svg {
    width: 16px;
    height: 16px;
}

/* ============================================================
   SHARED MODAL
   ============================================================ */
.shared-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 90000;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.shared-modal {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}

.shared-modal h3 {
    color: #f1f5f9;
    font-size: 1.25rem;
    margin: 0 0 1rem;
}

.shared-modal input,
.shared-modal textarea,
.shared-modal select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}

.shared-modal input:focus,
.shared-modal textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.shared-modal input::placeholder,
.shared-modal textarea::placeholder {
    color: #64748b;
}

.shared-modal .btn-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.shared-modal .btn-submit {
    flex: 1;
    padding: 0.75rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.shared-modal .btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.shared-modal .btn-cancel {
    padding: 0.75rem 1.25rem;
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.shared-modal .btn-cancel:hover {
    background: rgba(148, 163, 184, 0.1);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    #toast-container {
        top: 0.5rem;
        right: 0.5rem;
        width: calc(100% - 1rem);
    }

    .toast {
        padding: 0.75rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    .mobile-warning-card {
        padding: 2rem 1.5rem;
    }

    .shared-modal {
        padding: 1.5rem;
        border-radius: 12px;
    }
}
