/* StackZap Frontend — Design System */

/* ─── Base ─── */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ─── Logo — force white ─── */
.logo-white { filter: brightness(0) invert(1); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #0B0F15; }
::-webkit-scrollbar-thumb { background: #1E2738; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2A3450; }

/* ─── Animations ─── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes glow-pulse { 0%, 100% { box-shadow: 0 0 8px rgba(80, 211, 243, 0.15); } 50% { box-shadow: 0 0 20px rgba(80, 211, 243, 0.3); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-slide-up { animation: slideUp 0.35s ease-out; }
.animate-scale-in { animation: scaleIn 0.2s ease-out; }

/* ─── Shimmer loading ─── */
.shimmer {
    background: linear-gradient(90deg, #151B26 25%, #1C2433 50%, #151B26 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

/* ─── Card ─── */
.card {
    background: #151B26;
    border: 1px solid #1E2738;
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { border-color: #2A3450; }
.card-glow:hover { box-shadow: 0 0 15px rgba(80, 211, 243, 0.06); }

/* ─── Input / Select / Textarea ─── */
input, select, textarea {
    background: #0B0F15 !important;
    border: 1px solid #1E2738 !important;
    color: #E8EDF5 !important;
    border-radius: 8px !important;
    padding: 0.5rem 0.75rem !important;
    outline: none !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: #50D3F3 !important;
    box-shadow: 0 0 0 2px rgba(80, 211, 243, 0.12) !important;
}
input::placeholder, textarea::placeholder { color: #5A647C !important; }
select option { background: #151B26 !important; color: #E8EDF5 !important; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 1.125rem; border-radius: 8px;
    font-weight: 500; font-size: 0.875rem;
    transition: all 0.15s ease; cursor: pointer; border: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, #50D3F3, #2BA9C9);
    color: #0B0F15;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }

.btn-secondary {
    background: #1C2433; color: #E8EDF5; border: 1px solid #1E2738;
}
.btn-secondary:hover:not(:disabled) { background: #2A3450; border-color: #2A3450; }

.btn-danger {
    background: rgba(248, 113, 113, 0.1); color: #F87171;
    border: 1px solid rgba(248, 113, 113, 0.2);
}
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.2); }

.btn-success {
    background: rgba(52, 211, 153, 0.1); color: #34D399;
    border: 1px solid rgba(52, 211, 153, 0.2);
}
.btn-success:hover:not(:disabled) { background: rgba(52, 211, 153, 0.2); }

.btn-ghost {
    background: transparent; color: #8892A8;
}
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.04); color: #E8EDF5; }

.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.75rem; }
.btn-lg { padding: 0.625rem 1.25rem; font-size: 0.9375rem; }

/* ─── Table ─── */
.table-container {
    overflow-x: auto;
    border: 1px solid #1E2738;
    border-radius: 12px;
}
table { width: 100%; border-collapse: collapse; }
thead th {
    background: #1C2433; color: #8892A8;
    font-weight: 600; font-size: 0.6875rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.75rem 1rem; text-align: left;
}
tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid #1E2738; font-size: 0.875rem; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover td { background: rgba(80, 211, 243, 0.02); }

/* ─── Badge ─── */
.badge {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.125rem 0.5rem; border-radius: 9999px;
    font-size: 0.75rem; font-weight: 500;
}

/* ─── Status dot ─── */
.status-dot {
    width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}
.status-dot.connected { background: #34D399; box-shadow: 0 0 6px rgba(52,211,153,0.4); }
.status-dot.disconnected { background: #F87171; }
.status-dot.connecting { background: #FBBF24; animation: pulse-soft 1.5s infinite; }
.status-dot.qr_pending { background: #50D3F3; animation: pulse-soft 1.5s infinite; }

/* ─── Modal ─── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 50; animation: fadeIn 0.15s ease-out;
}
.modal-content {
    animation: scaleIn 0.2s ease-out;
}

/* ─── QR container ─── */
.qr-container { background: white; padding: 0.75rem; border-radius: 10px; display: inline-block; }

/* ─── Copy tooltip ─── */
.copied-tooltip {
    position: absolute; top: -28px; left: 50%; transform: translateX(-50%);
    background: #1C2433; color: #E8EDF5; padding: 2px 8px;
    border-radius: 4px; font-size: 11px; white-space: nowrap;
}

/* ─── Flash/Notification ─── */
.flash-enter-active { transition: all 0.3s ease; }
.flash-leave-active { transition: all 0.2s ease; }
.flash-enter-from { opacity: 0; transform: translateY(-10px); }
.flash-leave-to { opacity: 0; transform: translateY(-6px); }

/* ─── Sidebar link ─── */
.sidebar-link {
    transition: all 0.15s ease;
}
.sidebar-link:hover {
    background: rgba(80, 211, 243, 0.06);
}
.sidebar-link.active {
    background: rgba(80, 211, 243, 0.1);
    color: #50D3F3;
}

/* ─── Tab style ─── */
.tab-active {
    color: #50D3F3;
    background: #151B26;
    border-bottom: 1px solid #1E2738;
}
.tab-inactive {
    color: #5A647C;
}
.tab-inactive:hover {
    color: #8892A8;
    background: rgba(21, 27, 38, 0.5);
}

/* ─── Alert ─── */
.alert {
    border-radius: 10px; padding: 0.75rem 1rem; font-size: 0.8125rem;
    display: flex; align-items: flex-start; gap: 0.625rem;
}
.alert-error { background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.15); color: #F87171; }
.alert-success { background: rgba(52, 211, 153, 0.08); border: 1px solid rgba(52, 211, 153, 0.15); color: #34D399; }
.alert-warning { background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.15); color: #FBBF24; }
.alert-info { background: rgba(80, 211, 243, 0.08); border: 1px solid rgba(80, 211, 243, 0.15); color: #50D3F3; }

/* ─── Switch toggle ─── */
.toggle { position: relative; display: inline-flex; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
    width: 36px; height: 20px; background: #1E2738; border-radius: 9999px;
    transition: background 0.2s ease;
}
.toggle input:checked + .toggle-track { background: #50D3F3; }
.toggle-thumb {
    position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; background: #E8EDF5; border-radius: 50%;
    transition: transform 0.2s ease;
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(16px); }

/* ─── Page transition ─── */
.page-enter-active { animation: fadeIn 0.25s ease-out; }
.page-leave-active { animation: fadeIn 0.15s ease-in reverse; }
