/* ============================================
   MOLTGAS - Gas Tracker & Fee Calculator
   Clean, Functional, Data-focused
   ============================================ */

:root {
    --bg: #0a0b0d;
    --card: #12141a;
    --card-hover: #1a1d25;
    --border: #1f2229;
    --text: #e8e8ed;
    --text-dim: #6b7280;
    --accent: #3b82f6;
    --accent-dim: rgba(59, 130, 246, 0.15);
    --green: #22c55e;
    --yellow: #eab308;
    --red: #ef4444;
    --base-blue: #0052ff;
    --eth-purple: #627eea;
    --font-main: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

::selection {
    background: var(--accent);
    color: white;
}

/* App */
.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.accent {
    color: var(--accent);
}

.network-switch {
    display: flex;
    gap: 0.5rem;
    background: var(--card);
    padding: 0.25rem;
    border-radius: 10px;
}

.network-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-dim);
    font-family: var(--font-main);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.network-btn:hover {
    color: var(--text);
}

.network-btn.active {
    background: var(--card-hover);
    color: var(--text);
}

.network-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.network-dot.base { background: var(--base-blue); }
.network-dot.eth { background: var(--eth-purple); }

/* Sections */
section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Gas Current */
.gas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    background: rgba(34, 197, 94, 0.15);
    border-radius: 50px;
    font-size: 0.75rem;
    color: var(--green);
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.gas-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.gas-card {
    background: var(--card-hover);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s;
}

.gas-card:hover {
    transform: translateY(-2px);
}

.gas-card.slow { border-top: 3px solid var(--yellow); }
.gas-card.standard { border-top: 3px solid var(--green); }
.gas-card.fast { border-top: 3px solid var(--red); }

.gas-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.gas-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
}

.gas-unit {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.gas-time {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
}

.last-update {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 1rem;
}

/* Calculator */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.calc-input {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.calc-input label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.calc-input select,
.calc-input input {
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.calc-input select:focus,
.calc-input input:focus {
    border-color: var(--accent);
}

.calc-input select {
    cursor: pointer;
}

.calc-result {
    background: var(--bg);
    border-radius: 10px;
    padding: 1rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    color: var(--text-dim);
}

.result-row.highlight {
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
    padding-top: 1rem;
}

.result-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.result-row.highlight .result-value {
    color: var(--green);
    font-size: 1.25rem;
}

/* Converter */
.converter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.convert-input {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.convert-input label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.convert-input input {
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.convert-input input:focus {
    border-color: var(--accent);
}

/* History */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.history-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.history-stats strong {
    color: var(--text);
    font-family: var(--font-mono);
}

.chart-container {
    height: 150px;
    position: relative;
}

#gasChart {
    width: 100%;
    height: 100%;
}

/* Best Time */
.time-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 4px;
    margin-bottom: 0.75rem;
}

.time-slot {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.2s;
}

.time-slot:hover {
    transform: scale(1.2);
    z-index: 1;
}

.time-slot.low { background: var(--green); }
.time-slot.medium { background: var(--yellow); }
.time-slot.high { background: var(--red); }

.time-note {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
}

/* Quick Actions */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--card-hover);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.action-btn span:first-child {
    font-size: 1.25rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.footer-note {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
}

.modal-content h3 {
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.modal-input {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.modal-input.full {
    display: block;
}

.modal-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    outline: none;
    width: 100%;
}

.modal-input span {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 0.625rem 1.25rem;
    background: var(--card-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-main);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-actions button:hover {
    border-color: var(--text-dim);
}

.modal-actions button.primary {
    background: var(--accent);
    border-color: var(--accent);
}

.modal-actions button.primary:hover {
    background: #2563eb;
}

/* Responsive */
@media (max-width: 640px) {
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .gas-cards {
        grid-template-columns: 1fr;
    }
    
    .calc-grid {
        grid-template-columns: 1fr;
    }
    
    .converter-grid {
        grid-template-columns: 1fr;
    }
    
    .time-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .history-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}
