/**
 * Crypto Trading Platform - Styles
 */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border: #334155;
    --positive: #10b981;
    --negative: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Navigation */
.navbar {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.nav-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

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

.view-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
}

.view-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-input {
    padding: 0.75rem 1rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 300px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--surface-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-link {
    background: transparent;
    color: var(--primary-color);
    padding: 0.5rem;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.refresh-icon {
    display: inline-block;
    font-size: 1.2rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.stat-card-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    border: none;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-card-primary .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

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

.stat-card-primary .stat-value {
    color: white;
}

/* Tables */
.table-container {
    background-color: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow-x: auto;
}

.crypto-table {
    width: 100%;
    border-collapse: collapse;
}

.crypto-table thead {
    background-color: var(--surface-hover);
}

.crypto-table th {
    padding: 1rem;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.crypto-table td {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.crypto-table tbody tr {
    transition: background-color 0.2s ease;
}

.crypto-table tbody tr:hover {
    background-color: var(--surface-hover);
}

.crypto-table small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.positive {
    color: var(--positive);
}

.negative {
    color: var(--negative);
}

/* Loading & Error States */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* Auth View */
.auth-container {
    max-width: 500px;
    margin: 2rem auto;
    background-color: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.auth-tabs {
    display: flex;
    background-color: var(--surface-hover);
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.auth-tab.active {
    background-color: var(--surface);
    color: var(--text-primary);
}

.auth-form {
    display: none;
    padding: 2rem;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 0.5rem;
}

.auth-form p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.auth-footer {
    padding: 1.5rem 2rem;
    background-color: var(--surface-hover);
    text-align: center;
}

.auth-footer p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Auth Required */
.auth-required {
    text-align: center;
    padding: 4rem 2rem;
}

.auth-message {
    max-width: 500px;
    margin: 0 auto;
}

.auth-message h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.auth-message p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* User Menu */
.user-menu {
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--surface);
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    font-size: 1.5rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-btn:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.info-box {
    background-color: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.info-box strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.5rem;
}

.info-box ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.info-box li {
    margin: 0.25rem 0;
}

.info-box a {
    color: var(--primary-color);
    text-decoration: none;
}

.info-box a:hover {
    text-decoration: underline;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1rem;
}

.section-header h3 {
    font-size: 1.3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: center;
    }
    
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .view-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .crypto-table {
        font-size: 0.9rem;
    }
    
    .crypto-table th,
    .crypto-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    
    .user-menu {
        right: 10px;
        left: 10px;
    }
}

@media (max-width: 480px) {
    .nav-brand h1 {
        font-size: 1.2rem;
    }
    
    .view-header h2 {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .crypto-table {
        font-size: 0.8rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view.active {
    animation: fadeIn 0.3s ease;
}

/* AI Analysis Styles */
.btn-ai {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border: none;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.btn-ai:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.modal-large {
    max-width: 900px;
}

.ai-info {
    background-color: var(--surface-hover);
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.ai-crypto-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.ai-crypto-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.ai-crypto-stats span {
    font-size: 1.2rem;
    font-weight: 600;
}

.ai-type-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-type-selector label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

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

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

.ai-summary {
    background-color: var(--surface-hover);
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.ai-summary h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.data-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: var(--surface);
    border-radius: 4px;
}

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

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

.ai-analysis-content {
    background-color: var(--surface-hover);
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.ai-analysis-content h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.analysis-text {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1rem;
}

.analysis-text p {
    margin-bottom: 1rem;
}

.analysis-text ul,
.analysis-text ol {
    margin: 1rem 0 1rem 1.5rem;
}

.analysis-text li {
    margin: 0.5rem 0;
}

.analysis-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.analysis-meta small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.ai-disclaimer {
    background-color: rgba(251, 191, 36, 0.1);
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.ai-disclaimer small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* Responsive AI Modal */
@media (max-width: 768px) {
    .modal-large {
        max-width: 95%;
    }
    
    .ai-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .data-summary-grid {
        grid-template-columns: 1fr;
    }
}