:root {
    --bg-primary: #fafbfc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f6f8fa;
    --text-primary: #1a1f36;
    --text-secondary: #697386;
    --text-tertiary: #8792a2;
    --border: #e3e8ee;
    --accent: #0a2540;
    --success: #00d4aa;
    --danger: #ff6b6b;
    --warning: #ffa94d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #fafbfc 0%, #f0f2f5 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 150%;
    background: radial-gradient(circle, rgba(10, 37, 64, 0.03) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-30px, 30px) rotate(5deg); }
}

.login-box {
    background: var(--bg-secondary);
    padding: 4rem 3rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    max-width: 420px;
    width: 100%;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    font-family: 'Spectral', serif;
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 3rem;
    font-weight: 300;
}

.github-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    font-family: 'Public Sans', sans-serif;
}

.github-btn:hover {
    background: #0d3a5c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 37, 64, 0.15);
}

.github-btn:active {
    transform: translateY(0);
}

.github-icon {
    width: 20px;
    height: 20px;
}

.login-footer {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

/* Main App */
.app-container {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

.logo {
    font-family: 'Spectral', serif;
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: -0.01em;
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.balance-display {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.balance-amount {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-left: 0.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 3px;
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Main Content */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
}

/* Market Overview */
.market-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.section-title {
    font-family: 'Spectral', serif;
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--accent);
}

.market-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-change {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.positive { color: var(--success); }
.negative { color: var(--danger); }

/* Market List */
.market-list {
    background: var(--bg-secondary);
    border-radius: 3px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.market-item {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 120px;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.market-item:last-child {
    border-bottom: none;
}

.market-item:hover {
    background: var(--bg-tertiary);
}

.market-item.selected {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
}

.coin-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.coin-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: white;
}

.coin-name {
    display: flex;
    flex-direction: column;
}

.coin-symbol {
    font-weight: 600;
    font-size: 0.95rem;
}

.coin-full-name {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.price {
    font-weight: 600;
    font-size: 1.05rem;
}

.change {
    font-weight: 500;
    font-size: 0.9rem;
}

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

/* Trading Panel */
.trading-panel {
    position: sticky;
    top: 88px;
    height: fit-content;
}

.panel-card {
    background: var(--bg-secondary);
    border-radius: 3px;
    border: 1px solid var(--border);
    padding: 2rem;
}

.panel-title {
    font-family: 'Spectral', serif;
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.trade-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.trade-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
    font-family: 'Public Sans', sans-serif;
}

.trade-tab.active {
    color: var(--accent);
}

.trade-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.selected-coin-display {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.selected-coin-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.selected-coin-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.selected-coin-price {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
}

.input-field {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 1rem;
    font-family: 'Public Sans', sans-serif;
    transition: all 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.05);
}

.input-suffix {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.quick-amounts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.quick-btn {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Public Sans', sans-serif;
}

.quick-btn:hover {
    background: var(--border);
}

.trade-summary {
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: 3px;
    margin-bottom: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.summary-row:last-child {
    margin-bottom: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-weight: 600;
}

.summary-label {
    color: var(--text-secondary);
}

.summary-value {
    color: var(--text-primary);
    font-weight: 500;
}

.trade-button {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 3px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Public Sans', sans-serif;
}

.trade-button.buy {
    background: var(--success);
    color: white;
}

.trade-button.buy:hover {
    background: #00c299;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.2);
}

.trade-button.sell {
    background: var(--danger);
    color: white;
}

.trade-button.sell:hover {
    background: #ff5252;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
}

.trade-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Portfolio Section */
.portfolio-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.portfolio-title {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.portfolio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.portfolio-item:last-child {
    border-bottom: none;
}

.portfolio-coin {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.portfolio-coin-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
}

.portfolio-details {
    display: flex;
    flex-direction: column;
}

.portfolio-amount {
    font-weight: 600;
    font-size: 0.9rem;
}

.portfolio-value {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.portfolio-profit {
    text-align: right;
}

.profit-amount {
    font-weight: 600;
    font-size: 0.9rem;
}

.profit-percent {
    font-size: 0.8rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 3px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(120%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .trading-panel {
        position: relative;
        top: 0;
    }

    .market-item {
        grid-template-columns: 2fr 1fr 1fr;
    }

    .volume, .market-cap {
        display: none;
    }
}

@media (max-width: 768px) {
    .market-stats {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        height: auto;
        padding: 1rem 0;
        gap: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .login-box {
        padding: 2rem 1.5rem;
    }
}
