/* Color System */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --text-primary: #f0f0f5;
    --text-secondary: #8888aa;
    --accent: #00d4ff;
    --accent-glow: rgba(0, 212, 255, 0.15);
    --accent-dark: rgba(0, 212, 255, 0.08);
    --success: #00e676;
    --success-glow: rgba(0, 230, 118, 0.15);
    --danger: #ff1744;
    --danger-glow: rgba(255, 23, 68, 0.15);
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.03);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0f0f18 100%);
    position: relative;
}

/* Animated background gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 230, 118, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* App Container */
.app-container {
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    padding-bottom: 20px;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 16px 16px;
}

.header-content {
    max-width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.app-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.header-stats {
    display: flex;
    gap: 12px;
}

.stat-badge {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Glass Panel */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* Welcome Section */
.welcome-section {
    margin-top: 0;
}

.welcome-card h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.welcome-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* Analysis Section */
.analysis-section {
    display: none;
}

.analysis-section.visible {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.analysis-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.activity-score {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-dark);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.score-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.score-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

/* Transaction Flow */
.transaction-flow {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flow-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.transaction-item:nth-child(1) { animation-delay: 0.1s; opacity: 0; }
.transaction-item:nth-child(2) { animation-delay: 0.15s; opacity: 0; }
.transaction-item:nth-child(3) { animation-delay: 0.2s; opacity: 0; }
.transaction-item:nth-child(4) { animation-delay: 0.25s; opacity: 0; }
.transaction-item:nth-child(5) { animation-delay: 0.3s; opacity: 0; }

.transaction-icon {
    font-size: 20px;
    min-width: 24px;
}

.transaction-icon.buy {
    color: var(--success);
    animation: pulse-success 1.5s ease-in-out infinite;
}

.transaction-icon.sell {
    color: var(--danger);
    animation: pulse-danger 1.5s ease-in-out infinite;
}

.transaction-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.transaction-type {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.transaction-amount {
    font-size: 12px;
    color: var(--text-secondary);
}

.transaction-time {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Alert Summary */
.alert-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.alert-item.alert-buy {
    background: rgba(0, 230, 118, 0.08);
    border-color: rgba(0, 230, 118, 0.2);
}

.alert-item.alert-sell {
    background: rgba(255, 23, 68, 0.08);
    border-color: rgba(255, 23, 68, 0.2);
}

.alert-icon {
    font-size: 20px;
}

.alert-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert-type {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.alert-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* History Section */
.history-section {
    margin-top: 20px;
}

.section-header {
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.history-item:nth-child(1) { animation-delay: 0.05s; opacity: 0; }
.history-item:nth-child(2) { animation-delay: 0.1s; opacity: 0; }
.history-item:nth-child(3) { animation-delay: 0.15s; opacity: 0; }

.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.history-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-score {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--accent-dark);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

/* Premium Section */
.premium-section {
    margin-top: 20px;
    border: 2px solid var(--accent);
}

.premium-header {
    margin-bottom: 20px;
}

.premium-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    color: var(--accent);
}

.premium-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.premium-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--accent-dark);
    border-radius: var(--radius-md);
}

.feature-icon {
    font-size: 20px;
}

.feature-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.premium-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    touch-action: manipulation;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    letter-spacing: -0.01em;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, rgba(0, 212, 255, 0.8) 100%);
    color: var(--bg-primary);
    font-weight: 700;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-premium {
    background: linear-gradient(135deg, var(--accent) 0%, rgba(0, 230, 118, 0.6) 100%);
    color: var(--bg-primary);
    font-weight: 700;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-small {
    padding: 10px 16px;
    font-size: 13px;
    min-height: 40px;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

/* Animations */
@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-success {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 0 0 rgba(0, 230, 118, 0));
    }
    50% {
        opacity: 0.8;
        filter: drop-shadow(0 0 8px rgba(0, 230, 118, 0.5));
    }
}

@keyframes pulse-danger {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 0 0 rgba(255, 23, 68, 0));
    }
    50% {
        opacity: 0.8;
        filter: drop-shadow(0 0 8px rgba(255, 23, 68, 0.5));
    }
}

.animate-in {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-in:nth-child(1) { animation-delay: 0.1s; }
.animate-in:nth-child(2) { animation-delay: 0.2s; }
.animate-in:nth-child(3) { animation-delay: 0.3s; }
.animate-in:nth-child(4) { animation-delay: 0.4s; }

/* Hidden State */
.hidden {
    display: none;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-stats {
        width: 100%;
    }

    .stat-badge {
        flex: 1;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .main-content {
        gap: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Haptic feedback support */
@supports (width: 1px) {
    .btn {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
}
