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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 1rem;
    font-weight: 400;
}

.login-form {
    margin-bottom: 30px;
}

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

.input-group label {
    display: block;
    color: #555;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.input-hint {
    margin-top: 5px;
    color: #888;
    font-size: 0.8rem;
}

.form-options {
    margin-bottom: 25px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #555;
    font-size: 0.9rem;
}

.checkbox-label input {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    position: relative;
    overflow: hidden;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-text {
    display: inline-block;
}

.btn-loader {
    display: none;
}

.login-help {
    margin-top: 25px;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.login-help p {
    color: #555;
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.login-help ul {
    list-style: none;
    padding-left: 15px;
}

.login-help li {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 5px;
    position: relative;
}

.login-help li:before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
    color: #888;
    font-size: 0.85rem;
}

/* Dashboard Container */
.dashboard-container {
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

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

.header-left h1 {
    color: #333;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 5px;
}

#user-info {
    color: #666;
    font-size: 0.9rem;
}

#current-app-id {
    font-weight: 600;
    color: #667eea;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

.wallet-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    grid-column: span 2;
}

.chart-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.wallet {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.wallet-header {
    font-size: 1.8rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.wallet-header::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 2px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.summary-card h3 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    opacity: 0.9;
}

.summary-card .usd {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.summary-card .kes {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
}

.summary-card .trades {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
}

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

.stat {
    background: linear-gradient(135deg, #ffffff, #f8f9ff);
    border-radius: 15px;
    padding: 20px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

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

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

.stat-title {
    font-size: 1rem;
    font-weight: 600;
    color: #555;
}

.stat-period {
    font-size: 0.8rem;
    color: #888;
    background: #f0f2f5;
    padding: 4px 8px;
    border-radius: 20px;
}

.stat-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 10px;
}

.stat-value {
    text-align: center;
}

.stat-value .label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

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

.stat-value .amount.usd {
    color: #667eea;
}

.stat-value .amount.kes {
    color: #764ba2;
}

.stat-runs {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    padding: 8px;
    background: #f8f9ff;
    border-radius: 8px;
}

.trade-count {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    padding: 8px;
    background: #f0f7ff;
    border-radius: 8px;
    margin-top: 5px;
}

.chart-header {
    text-align: center;
    margin-bottom: 15px;
}

.chart-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.chart-header p {
    color: #666;
    font-size: 0.85rem;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

canvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: 15px;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #666;
    font-size: 1.1rem;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

/* Connection Status */
.connection-status {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
}

.status-dot.connected {
    background: #4CAF50;
    animation: pulse 2s infinite;
}

.status-dot.disconnected {
    background: #f44336;
}

.status-dot.connecting {
    background: #FF9800;
    animation: blink 1.5s infinite;
}

.status-text {
    font-size: 0.9rem;
    color: #666;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

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

/* Stats Summary Section */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.stat-summary {
    background: #f8f9ff;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.stat-summary .label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-summary .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header-left h1 {
        font-size: 1.5rem;
    }

    .logout-btn {
        align-self: flex-end;
    }

    .wallet-section,
    .chart-section {
        padding: 20px;
    }

    .summary-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-values {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .chart-container {
        height: 250px;
    }

    .login-box {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header-left h1 {
        font-size: 1.3rem;
    }

    .wallet-section,
    .chart-section {
        padding: 15px;
    }

    .summary-card {
        padding: 15px;
    }

    .stat {
        padding: 15px;
    }

    .chart-container {
        height: 220px;
    }
    
    .stats-summary {
        grid-template-columns: 1fr;
    }

    .login-header h1 {
        font-size: 1.8rem;
    }
}