* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #141b2d;
    --bg-card: #1a2332;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #2d3748;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.mobile-container {
    min-height: 100vh;
    padding-bottom: 84px;
}

/* Header */
.mobile-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
}

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

.mobile-header h1 {
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:active {
    transform: scale(0.95);
    background: var(--accent-primary);
}

.stats-compact {
    display: flex;
    gap: 8px;
    justify-content: space-around;
}

.last-update-mobile {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: left;
}

.timeframe-hints {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.time-hint-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    text-align: left;
}

.time-hint-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.time-hint-value {
    display: block;
    font-size: 0.78rem;
    color: var(--text-primary);
    font-weight: 600;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 8px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.stat-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    z-index: 200;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.settings-panel.active {
    transform: translateY(0);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.settings-header h3 {
    font-size: 1.2rem;
}

.settings-content {
    padding: 16px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.setting-group input,
.setting-group select {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    width: auto;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-label:has(input:checked) {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-primary);
}

.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
}

.radio-label span {
    flex: 1;
    font-size: 0.95rem;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 20px;
}

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

.view-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.view-link {
    display: block;
    padding: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Search Bar */
.search-bar {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
    position: sticky;
    top: 140px;
    z-index: 99;
}

.search-bar input {
    flex: 1;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Coins List */
.coins-list {
    padding: 0;
}

.coin-row-mobile {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    gap: 8px;
    transition: background 0.2s;
}

.coin-row-mobile:active {
    background: var(--bg-hover);
}

.coin-info {
    flex: 1;
    min-width: 0;
}

.coin-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.coin-symbol {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.coin-badge-mobile {
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 3px;
    background: var(--accent-primary);
    color: white;
    font-weight: 700;
}

.coin-price-row {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.coin-change-mobile {
    text-align: right;
    min-width: 70px;
}

.change-value {
    font-size: 0.95rem;
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

.change-value.positive {
    color: var(--success);
}

.change-value.negative {
    color: var(--danger);
}

.volume-value {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.rsi-compact {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 120px;
}

.rsi-item-compact {
    flex: 1;
    text-align: center;
}

.rsi-label-compact {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.rsi-value-compact {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 6px;
    border-radius: 4px;
    display: inline-block;
    min-width: 42px;
}

.rsi-value-compact.high {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

.rsi-value-compact.medium {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.15);
}

.rsi-value-compact.low {
    color: var(--success);
    background: rgba(16, 185, 129, 0.15);
}

.rsi-value-compact.error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.18);
}

/* Footer */
.mobile-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(20, 27, 45, 0.98);
    border-top: 1px solid var(--border);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    text-align: center;
    z-index: 999;
}

.update-time {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.hint {
    font-size: 0.85rem !important;
    opacity: 0.7;
}

/* Botão de Trade */
.btn-trade {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-trade:active {
    transform: scale(0.9);
    opacity: 0.8;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 90%;
    text-align: center;
    font-size: 0.95rem;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-info {
    border-left: 4px solid var(--accent-primary);
}

.toast.fade-out {
    animation: slideOut 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* Landscape adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .mobile-header {
        padding: 8px 16px;
    }
    
    .stats-compact {
        gap: 6px;
    }
    
    .stat-item {
        padding: 6px;
    }
    
    .coin-card-mobile {
        padding: 12px;
        margin-bottom: 8px;
    }
}

@media (max-width: 520px) {
    .timeframe-hints {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
