/**
 * Secureon Wallet - Modern Stylesheet
 * Professional cryptocurrency wallet UI
 */

/* ============================================
   BASE STYLES
   ============================================ */

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background-color: #020617;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes scale-in {
    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 shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes bounce-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.6); }
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

.animate-fade-in-up {
    animation: fade-in-up 0.5s ease-out;
}

.animate-slide-down {
    animation: slide-down 0.3s ease-out;
}

.animate-scale-in {
    animation: scale-in 0.3s ease-out;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-shimmer {
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.1) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ============================================
   INPUTS & FORMS
   ============================================ */

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #1e293b inset !important;
    -webkit-text-fill-color: #fff !important;
    transition: background-color 5000s ease-in-out 0s;
}

input::placeholder,
textarea::placeholder {
    color: #64748b;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px !important;
}

/* ============================================
   BUTTONS
   ============================================ */

button {
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: none;
}

button:active:not(:disabled) {
    transform: scale(0.98) !important;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

button:disabled:hover {
    transform: none !important;
}

/* Button loading state */
button.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   SEED WORDS
   ============================================ */

.seed-word {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    padding: 10px 12px;
    border-radius: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: #fff;
    position: relative;
    text-align: center;
    transition: all 0.2s ease;
}

.seed-word::before {
    content: attr(data-index);
    position: absolute;
    top: -8px;
    left: 10px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
}

.seed-word:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
}

/* ============================================
   TRANSACTION ITEMS
   ============================================ */

.tx-item {
    padding: 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tx-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.tx-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tx-icon.sent {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(249, 115, 22, 0.2));
}

.tx-icon.received {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.2));
}

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

.tx-icon.sent svg {
    color: #f97316;
    transform: rotate(180deg);
}

.tx-icon.received svg {
    color: #22c55e;
}

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

.toast {
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: slide-in-right 0.3s ease;
    max-width: 320px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slide-out-right {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.toast-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(16, 185, 129, 0.9));
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.toast-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.9));
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9));
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.toast-info {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(79, 70, 229, 0.9));
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* ============================================
   PASSWORD STRENGTH
   ============================================ */

.strength-weak { color: #ef4444; }
.strength-medium { color: #f59e0b; }
.strength-strong { color: #22c55e; }

.strength-bar {
    height: 4px;
    border-radius: 2px;
    background: #334155;
    overflow: hidden;
    margin-top: 8px;
}

.strength-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.strength-bar-fill.weak {
    width: 33%;
    background: linear-gradient(90deg, #ef4444, #f97316);
}

.strength-bar-fill.medium {
    width: 66%;
    background: linear-gradient(90deg, #f59e0b, #eab308);
}

.strength-bar-fill.strong {
    width: 100%;
    background: linear-gradient(90deg, #22c55e, #10b981);
}

/* ============================================
   QR CODE
   ============================================ */

#qr-code canvas,
#qr-code img {
    border-radius: 16px;
}

/* ============================================
   ADDRESS DISPLAY
   ============================================ */

#confirm-to-enhanced {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 14px;
    letter-spacing: 0.5px;
    line-height: 1.8;
    word-break: break-all;
}

.address-highlight {
    color: #22c55e;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.address-middle {
    color: #94a3b8;
}

/* ============================================
   NETWORK INDICATORS
   ============================================ */

.network-mainnet {
    color: #22c55e;
}

.network-testnet {
    color: #f59e0b;
}

/* ============================================
   LOADING STATES
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.loading-dots::after {
    content: '';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ============================================
   COPY FEEDBACK
   ============================================ */

.copy-success {
    animation: copy-pulse 0.3s ease;
}

@keyframes copy-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ============================================
   MODAL BACKDROP
   ============================================ */

.modal-backdrop {
    backdrop-filter: blur(8px);
}

/* ============================================
   GRADIENT TEXT
   ============================================ */

.gradient-text {
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   CARD EFFECTS
   ============================================ */

.card-glow {
    position: relative;
}

.card-glow::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.card-glow:hover::before {
    opacity: 1;
}

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

@media (max-width: 640px) {
    .seed-word {
        font-size: 11px;
        padding: 8px 6px;
    }
    
    .seed-word::before {
        font-size: 8px;
        padding: 1px 4px;
        top: -6px;
        left: 6px;
    }
    
    .toast {
        max-width: calc(100vw - 32px);
    }
}

/* ============================================
   SAFE AREA (iOS)
   ============================================ */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    #seed-words,
    #exported-seed-words,
    input[type="password"],
    #qr-code,
    .seed-word {
        display: none !important;
    }
    
    body::after {
        content: "Conteúdo sensível ocultado para impressão";
        display: block;
        padding: 20px;
        text-align: center;
        font-weight: bold;
    }
}

/* ============================================
   FOCUS VISIBLE
   ============================================ */

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* ============================================
   SELECTION
   ============================================ */

::selection {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

/* ============================================
   PWA STYLES
   ============================================ */

/* Safe area insets for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .pwa-standalone body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .pwa-standalone header {
        padding-top: calc(1rem + env(safe-area-inset-top));
    }
}

/* PWA Install Button */
#pwa-install-btn {
    position: fixed;
    bottom: 80px;
    right: 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 1000;
    animation: bounce-subtle 2s ease-in-out infinite;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#pwa-install-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.5);
}

#pwa-install-btn svg {
    width: 20px;
    height: 20px;
}

/* Standalone mode adjustments */
.pwa-standalone #pwa-install-btn {
    display: none !important;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.visible {
    transform: translateY(0);
}

.offline-indicator.online {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

/* Update available banner */
.update-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.update-banner.visible {
    transform: translateY(0);
}

.update-banner-text {
    flex: 1;
}

.update-banner-title {
    font-weight: 600;
    font-size: 14px;
}

.update-banner-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.update-banner-btn {
    background: white;
    color: #6366f1;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.update-banner-btn:hover {
    transform: scale(1.05);
}

/* Pull to refresh indicator */
.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: rgba(99, 102, 241, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 8px 16px;
    border-radius: 0 0 12px 12px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.pull-refresh-indicator.visible {
    transform: translateX(-50%) translateY(0);
}

.pull-refresh-indicator svg {
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

/* ============================================
   BALANCE CARD PATTERN
   ============================================ */

.balance-pattern {
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 40%);
}

/* ============================================
   COUNTDOWN
   ============================================ */

#seed-countdown {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   ACTION BUTTONS HOVER
   ============================================ */

#btn-send:hover .w-12,
#btn-receive:hover .w-12,
#btn-settings:hover .w-12 {
    transform: scale(1.1);
}

/* ============================================
   SECURITY BADGES
   ============================================ */

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 100px;
    font-size: 11px;
    color: #86efac;
}

/* ============================================
   TOKEN VERIFICATION BADGES
   ============================================ */

.token-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 100px;
    font-size: 10px;
    color: #4ade80;
    font-weight: 500;
}

.token-unverified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 100px;
    font-size: 10px;
    color: #fbbf24;
    font-weight: 500;
}

.token-suspicious-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 100px;
    font-size: 10px;
    color: #f87171;
    font-weight: 500;
}

/* Verification icon animation */
.verification-icon {
    animation: verification-pulse 2s ease-in-out infinite;
}

@keyframes verification-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================
   TRANSACTION LIST LOADING
   ============================================ */

.tx-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    gap: 12px;
}

.tx-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #334155;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.glass {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(71, 85, 105, 0.3);
}

/* ============================================
   HOVER LIFT
   ============================================ */

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* ============================================
   TUTORIAL MODAL
   ============================================ */

.tutorial-tab {
    color: #64748b;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tutorial-tab:hover {
    color: #94a3b8;
    background: rgba(99, 102, 241, 0.05);
}

.tutorial-tab.active {
    color: #818cf8;
    border-bottom-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.tutorial-panel {
    animation: fade-in 0.25s ease-out;
}

/* FAQ Accordion */
details summary {
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details[open] summary {
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
    padding-bottom: 12px;
    margin-bottom: 0;
}

details[open] > div {
    animation: fade-in 0.2s ease-out;
}
