/* ============================================================
   S4 4.20 — Explorer DS Font Integration
   @import must precede @tailwind directives
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

h1, h2, h3, h4, h5, h6,
.text-lg, .text-xl, .text-2xl {
    font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

code, pre, .font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ============================================================
   S5.7 — Standalone Widget Component CSS
   Replaces DaisyUI with self-contained component styles
   ============================================================ */

/* --- Modal --- */
.modal-toggle {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-toggle:checked ~ .modal {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.25rem;
    max-width: 32rem;
    width: 90vw;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
}

.dark .modal-box {
    background: rgba(15, 20, 25, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.05);
}

.modal-action {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* --- Button --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.btn:hover {
    background: #f3f4f6;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-xs {
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
}

.btn-circle {
    border-radius: 9999px;
    width: 2rem;
    height: 2rem;
    padding: 0;
}

.btn-sm.btn-circle {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.75rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0066ff, #3b82f6);
    border: 1px solid rgba(0, 102, 255, 0.2);
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px -5px rgba(0, 102, 255, 0.4);
    background: linear-gradient(135deg, #0066ff, #3b82f6);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dark .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-link {
    background: transparent;
    border-color: transparent;
    color: #0066ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.btn-link:hover {
    background: transparent;
    border-color: transparent;
    text-decoration-thickness: 2px;
}

/* Close button (circle btn) */
.dark .btn.btn-sm.btn-circle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
}

.dark .btn.btn-sm.btn-circle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #e5e7eb;
}

/* --- Form --- */
.form-control {
    width: 100%;
    position: relative;
}

.label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.label-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.dark .label-text {
    color: #e5e7eb;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group > .input,
.input-group > .select {
    width: auto;
    min-width: 0;
}

.join {
    display: flex;
}

.join-item {
    border-radius: 0;
}

.join-item:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.join-item:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

.input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    background: #ffffff;
    color: #111827;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.input:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.input::placeholder {
    color: #9ca3af;
}

.dark .input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}

.dark .input:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.dark .input::placeholder {
    color: #6b7280;
}

.select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    background: #ffffff;
    color: #111827;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    appearance: auto;
}

.select-bordered {
    border: 1px solid #d1d5db;
}

.select:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.dark .select {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}

.dark .select option {
    background: #0f1419;
    color: #e5e7eb;
}

.dark .select:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    background: #ffffff;
    color: #111827;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    resize: vertical;
}

.textarea:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.textarea::placeholder {
    color: #9ca3af;
}

.dark .textarea {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}

.dark .textarea:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.dark .textarea::placeholder {
    color: #6b7280;
}

/* --- Alert --- */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
}

.alert-success {
    background: rgba(63, 182, 139, 0.1);
    color: #065f46;
    border: 1px solid rgba(63, 182, 139, 0.2);
}

.dark .alert-success {
    background: rgba(63, 182, 139, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #6ee7b7;
}

.alert-error {
    background: rgba(255, 83, 83, 0.1);
    color: #991b1b;
    border: 1px solid rgba(255, 83, 83, 0.2);
}

.dark .alert-error {
    background: rgba(255, 83, 83, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #fca5a5;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
}

.dark .toast {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* --- Dropdown --- */
.dropdown-content {
    position: absolute;
    z-index: 50;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -4px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    color: #374151;
}

.dropdown-content .text-gray-600,
.dropdown-content .text-gray-500,
.dropdown-content .text-sm,
.dropdown-content span,
.dropdown-content a {
    color: inherit;
}

.dark .dropdown-content {
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.5);
    color: #e5e7eb;
}

.dark .dropdown-content .text-gray-600,
.dark .dropdown-content .text-gray-500,
.dark .dropdown-content .text-sm,
.dark .dropdown-content span,
.dark .dropdown-content a {
    color: #e5e7eb;
}

/* Dropdown items inside dark dropdown should have visible hover */
.dark .dropdown-content .hover\:bg-gray-200:hover,
.dark .dropdown-content .hover\:bg-gray-100:hover {
    background: rgba(255, 255, 255, 0.08);
}

.divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.5rem 0;
}

.dark .divider {
    background: rgba(255, 255, 255, 0.08);
}

/* --- Card (used in TokenConvert dropdown) --- */
.card {
    background: transparent;
}

.card.dropdown-content {
    background: #ffffff;
}

.dark .card.dropdown-content {
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dark .card.dropdown-content .card-body {
    color: #e5e7eb;
}

.dark .card.dropdown-content li {
    color: #e5e7eb;
}

/* --- Loading --- */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 9999px;
    animation: spin 0.6s linear infinite;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 9999px;
    animation: spin 0.6s linear infinite;
}

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

/* --- Checkbox --- */
.checkbox {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    border: 2px solid #d1d5db;
    appearance: none;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.checkbox:checked {
    background: #0066ff;
    border-color: #0066ff;
}

.checkbox:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.35rem;
    height: 0.6rem;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

.checkbox-sm {
    width: 1rem;
    height: 1rem;
}

.checkbox-primary {
    accent-color: #0066ff;
}

.dark .checkbox {
    border-color: rgba(255, 255, 255, 0.2);
    background: transparent;
}

.dark .checkbox:checked {
    background: #0066ff;
    border-color: #0066ff;
}

/* --- Radio --- */
.radio {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    border: 2px solid #d1d5db;
    appearance: none;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.radio:checked {
    border-color: #0066ff;
}

.radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: #0066ff;
    transform: translate(-50%, -50%);
}

.radio-success:checked {
    border-color: #3fb68b;
}

.radio-success:checked::after {
    background: #3fb68b;
}

.radio-error:checked {
    border-color: #ff5353;
}

.radio-error:checked::after {
    background: #ff5353;
}

.radio-dark:checked {
    border-color: #1e40af;
}

.radio-dark:checked::after {
    background: #1e40af;
}

.dark .radio {
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- File Input --- */
.file-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem;
    font-size: 0.875rem;
    background: #ffffff;
    color: #111827;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.file-input:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.dark .file-input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}
