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

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #FFF5EB;
    color: #333;
    min-height: 100%;
    font-size: 14px;
}

.app {
    min-height: 100vh;
    padding-bottom: 2rem;
}

/* Header - Mobile First */
.header {
    background: linear-gradient(135deg, #FF8C42, #FF6B35);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header-buttons button {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-options {
    background: white;
    color: #FF6B35;
}

.btn-options:hover {
    background: #FFF5EB;
}

.btn-history {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
}

.btn-history:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-logout {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    padding: 0.4rem 0.6rem !important;
    font-size: 0.75rem !important;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.1);
}

.home-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.home-buttons .btn-options,
.home-buttons .btn-history {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    border: none;
}

.home-buttons .btn-history {
    background: #FF6B35;
    color: white;
    border: none !important;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-email {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    display: none;
}

/* Login Page - Mobile First */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    background: linear-gradient(135deg, #FFF5EB, #FFE4D6);
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(255, 107, 53, 0.15);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #FF6B35;
    margin-bottom: 0.5rem;
    font-size: 2rem;
    letter-spacing: 3px;
}

.login-box p {
    text-align: center;
    color: #888;
    margin-bottom: 1.5rem;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-box input {
    padding: 0.875rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-box input:focus {
    outline: none;
    border-color: #FF8C42;
}

.login-box button {
    padding: 0.875rem;
    background: linear-gradient(135deg, #FF8C42, #FF6B35);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 107, 53, 0.3);
}

.login-box button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    background: #FEE2E2;
    color: #DC2626;
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.875rem;
}

/* Main Content - Mobile First */
.main-content {
    padding: 1rem;
    padding-bottom: 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

.page-title {
    font-size: 1.25rem;
    color: #333;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-title-right {
    margin-left: auto;
    font-size: 0.9rem;
}

.back-button {
    background: none;
    border: none;
    color: #FF6B35;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.back-button:hover {
    background: rgba(255, 107, 53, 0.1);
}

/* Strategy Cards - Mobile First */
.strategies-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.strategy-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.strategy-name {
    font-weight: 600;
    color: #FF6B35;
    font-size: 0.95rem;
}

.strategy-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.strategy-badge.active {
    background: #D1FAE5;
    color: #059669;
}

.strategy-badge.inactive {
    background: #FEE2E2;
    color: #DC2626;
}

.strategy-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.stat-item {
    background: #FFF5EB;
    padding: 0.5rem;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
}

.stat-value.positive {
    color: #10B981;
}

.stat-value.negative {
    color: #EF4444;
}

.stat-label {
    font-size: 0.7rem;
    color: #888;
    margin-top: 0.125rem;
}

/* Global Stats */
.global-stats {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.global-stat {
    text-align: center;
    padding: 0.5rem;
}

.global-stat-value {
    font-weight: 700;
    font-size: 1.25rem;
    color: #FF6B35;
}

.global-stat-label {
    font-size: 0.7rem;
    color: #888;
}

/* Trades List - Mobile First */
.trades-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trade-card {
    background: white;
    border-radius: 10px;
    padding: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.trade-card:active {
    transform: scale(0.98);
}

.trade-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trade-row:not(:last-child) {
    margin-bottom: 0.5rem;
}

.trade-token {
    font-weight: 600;
}

.trade-token .symbol {
    color: #FF6B35;
    font-size: 1rem;
}

.trade-token .name {
    color: #888;
    font-size: 0.75rem;
}

.trade-strategy {
    font-size: 0.75rem;
    color: #666;
    background: #f5f5f5;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.trade-amount {
    text-align: right;
    font-size: 0.85rem;
}

.trade-amount .sol {
    font-weight: 600;
    color: #333;
}

.trade-amount .date {
    color: #888;
    font-size: 0.7rem;
}

.trade-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.trade-status.confirmed {
    background: #D1FAE5;
    color: #059669;
}

.trade-status.sold {
    background: #E0E7FF;
    color: #4F46E5;
}

.trade-status.pending {
    background: #FEF3C7;
    color: #D97706;
}

.trade-status.failed {
    background: #FEE2E2;
    color: #DC2626;
}

.trade-profit {
    text-align: right;
    font-weight: 600;
    font-size: 0.9rem;
}

.trade-profit.positive {
    color: #10B981;
}

.trade-profit.negative {
    color: #EF4444;
}

.btn-sell {
    background: #EF4444;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-sell:hover {
    background: #DC2626;
}

.btn-sell:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

/* Trade Detail - Mobile First */
.trade-detail {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.trade-detail h2 {
    color: #FF6B35;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.detail-item {
    padding: 0.75rem;
    background: #FFF5EB;
    border-radius: 8px;
}

.detail-item label {
    display: block;
    color: #888;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.detail-item value {
    display: block;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    word-break: break-all;
}

.detail-item .mint {
    font-family: monospace;
    font-size: 0.7rem;
}

/* Options Page - Mobile First */
.options-container {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.options-section {
    margin-bottom: 1.5rem;
}

.options-section:last-child {
    margin-bottom: 0;
}

.options-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #FF6B35;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.option-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f5f5f5;
}

.option-row:last-child {
    border-bottom: none;
}

.option-key {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.option-value {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.option-value select,
.option-value input {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #eee;
    border-radius: 6px;
    font-size: 0.875rem;
}

.option-value select:focus,
.option-value input:focus {
    outline: none;
    border-color: #FF8C42;
}

.btn-save {
    padding: 0.5rem 0.75rem;
    background: #FF6B35;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-save:hover {
    background: #FF8C42;
}

.btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-danger {
    padding: 0.5rem 1rem;
    background: #EF4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-danger:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

.danger-zone {
    border: 1px solid #FCA5A5;
    background: #FEF2F2;
}

.danger-zone .options-section-title {
    color: #DC2626;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #FFF5EB;
    border-top-color: #FF6B35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Load More Button */
.load-more {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.btn-load-more {
    padding: 0.75rem 2rem;
    background: white;
    color: #FF6B35;
    border: 2px solid #FF6B35;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-load-more:hover {
    background: #FF6B35;
    color: white;
}

.btn-load-more:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tablet and Desktop */
@media (min-width: 640px) {
    body {
        font-size: 15px;
    }

    .header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.5rem;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .user-email {
        display: inline;
    }

    .main-content {
        padding: 1.5rem;
    }

    .strategies-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .strategy-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .option-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .option-value {
        width: auto;
    }

    .trade-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    }
}

@media (min-width: 1024px) {
    .strategies-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .detail-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .login-box {
        padding: 3rem;
    }
}
