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

body {
    font-family: 'Segoe UI', 'San Francisco', 'Helvetica Neue', sans-serif;
    background-color: #f7f9fc;
    color: #333;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Layout Structure */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Reset Button Styles */
.reset-container {
    display: flex;
    justify-content: flex-end;
    padding: 0 20px 10px 0;
}

.reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.reset-btn:hover {
    background-color: #cc0000;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.reset-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.reset-btn i {
    font-size: 14px;
    margin-right: 6px;
}

/* Loading spinner for reset button */
.fa-spinner {
    -webkit-animation: spin 1s linear infinite;
    -moz-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
}

@-moz-keyframes spin {
    100% { -moz-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
    100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
    100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

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

/* Sidebar Styles */
.sidebar {
    width: 240px;
    background-color: #ffffff;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 20px 25px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f0f2f5;
}

.logo-icon {
    color: #6366f1;
    font-size: 24px;
    margin-right: 10px;
}

/* Logo text styling with hover animation */
.logo span {
    font-weight: 700;
    font-size: 20px;
    color: #222;
    position: relative;
    cursor: default;
    transition: color 0.3s ease-in-out;
}

/* SVG path for the animation effect */
.logo span::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background-color: #6366f1;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.5s ease-in-out;
}

/* Hover effects */
.logo span:hover {
    color: #6366f1;
}

.logo span:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.main-nav {
    flex-grow: 1;
    padding: 20px 0;
}

.main-nav ul {
    list-style: none;
}

.main-nav li {
    margin-bottom: 5px;
}

.main-nav a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: #64748b;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s ease;
}

.main-nav a i {
    margin-right: 12px;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.main-nav li.active a {
    color: #6366f1;
    background-color: rgba(99, 102, 241, 0.08);
    font-weight: 600;
    position: relative;
}

.main-nav li.active a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: #6366f1;
}

.main-nav a:hover {
    background-color: rgba(0, 0, 0, 0.03);
    color: #334155;
}

.sidebar-footer {
    padding: 20px 25px;
    border-top: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
}

.sidebar-footer a {
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
}

.sidebar-footer a i {
    margin-right: 6px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 20px 30px;
}

/* Top Header Bar */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.market-status {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.date-today {
    font-size: 14px;
    color: #64748b;
}

.market-indicators {
    display: flex;
    gap: 16px;
}

.market-item {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.value {
    font-weight: 600;
}

.value.up {
    color: #10b981;
}

.value.down {
    color: #ef4444;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    position: relative;
}

.search-box input {
    background-color: #f3f4f6;
    border: none;
    padding: 8px 16px 8px 36px;
    border-radius: 20px;
    font-size: 14px;
    width: 200px;
    transition: all 0.3s ease;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
}

.search-box input:focus {
    outline: none;
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-profile span {
    font-weight: 500;
}

.profile-image {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #6366f1;
    background-image: linear-gradient(45deg, #6366f1, #8b5cf6);
}

/* Dashboard Components */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 10px;
}

.stat-card {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-header {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 8px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #1e293b;
}

.change-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
}

.change-indicator.up {
    color: #10b981;
}

.change-indicator.down {
    color: #ef4444;
}

/* Chart Section */
.main-chart-section {
    background-color: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.chart-title h2 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 700;
    color: #1e293b;
}

.current-price {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
}

.price-change {
    font-size: 16px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.chart-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-end;
}

.time-filters {
    display: flex;
    gap: 5px;
}

.time-filter {
    border: none;
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
}

.time-filter.active {
    background-color: #6366f1;
    color: white;
}

.time-filter:hover:not(.active) {
    background-color: #e2e8f0;
    color: #334155;
}

.chart-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.buy-btn {
    background-color: #6366f1;
    color: white;
}

.buy-btn:hover {
    background-color: #4f46e5;
}

.sell-btn {
    background-color: white;
    color: #6366f1;
    border: 1px solid #6366f1;
}

.sell-btn:hover {
    background-color: rgba(99, 102, 241, 0.05);
}

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

/* Bottom Sections Layout */
.bottom-sections {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
    margin-bottom: 10px;
}

/* Table Styling */
.section-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #1e293b;
}

.market-subtitle {
    font-size: 14px;
    color: #64748b;
}

.market-subtitle .up {
    color: #10b981;
}

.market-subtitle .down {
    color: #ef4444;
}

.market-section, .portfolio-section, .trade-section {
    background-color: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.market-section h3, .portfolio-section h3, .trade-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1e293b;
}

/* Modern Tables */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    font-size: 14px;
}

.modern-table th {
    background-color: #f8fafc;
    color: #64748b;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.modern-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.modern-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Color indicators for change values */
.modern-table .up {
    color: #10b981;
    font-weight: 500;
}

.modern-table .down {
    color: #ef4444;
    font-weight: 500;
}

/* Action buttons in tables */
.table-action {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-buy {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.btn-buy:hover {
    background-color: rgba(16, 185, 129, 0.2);
}

.btn-sell {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-sell:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

/* Modern Form Styling */
.modern-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.modern-form input, 
.modern-form select {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    background-color: #fff;
    color: #334155;
    transition: all 0.2s ease;
}

.modern-form input:focus, 
.modern-form select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.trade-btn {
    background-color: #6366f1;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 10px;
}

.trade-btn:hover {
    background-color: #4f46e5;
}

/* Converter Tool */
.converter-tool {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid #f1f5f9;
}

.converter-inputs {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.converter-group {
    display: flex;
    flex: 1;
}

.converter-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px 0 0 6px;
    font-size: 14px;
}

.converter-group select,
.currency-label {
    width: 80px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-left: none;
    border-radius: 0 6px 6px 0;
    background-color: #f8fafc;
    font-size: 14px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.converter-inputs i {
    color: #64748b;
    font-size: 16px;
}

/* Chart Container Styles */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
    overflow: hidden; /* Ensures the gradient doesn't spill outside */
}

/* Enhanced Chart Styling */
.chart-container canvas {
    /* Smoother rendering */
    image-rendering: optimizeQuality;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Chart Background Styling - creates a subtle grid effect */
.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(200, 200, 200, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200, 200, 200, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 1;
}

/* Chart Glow Effect - adds a subtle glow to the chart line */
.chart-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* API Notice */
.api-notice {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #fff;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

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

.api-notice p {
    flex: 1;
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

.api-notice i {
    color: #6366f1;
    margin-right: 5px;
}

.api-notice button {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
}

.api-notice button:hover {
    color: #334155;
}

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

@media (max-width: 992px) {
    .chart-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .chart-options {
        align-items: flex-start;
    }
    
    .time-filters {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        overflow: hidden;
    }
    
    .logo span, .main-nav a span, .sidebar-footer span {
        display: none;
    }
    
    .main-nav a {
        justify-content: center;
        padding: 12px;
    }
    
    .main-nav a i {
        margin-right: 0;
    }
    
    .main-content {
        margin-left: 70px;
        padding: 15px;
    }
    
    .user-profile span {
        display: none;
    }
    
    .market-indicators {
        display: none;
    }
}

/* Page Navigation Styles */
.page-container {
    width: 100%;
}

.page {
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

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

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.page-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Portfolio Page Styles */
.portfolio-section.full-width {
    width: 100%;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.summary-card {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-title {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 8px;
}

/* History Page Styles */
.filter-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-size: 14px;
    color: #64748b;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
}

/* Stocks Page Styles */
.search-filter {
    margin-bottom: 20px;
}

.search-group {
    display: flex;
    max-width: 400px;
}

.search-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px 0 0 6px;
    font-size: 14px;
}

.search-group button {
    padding: 10px 15px;
    background-color: #6366f1;
    color: white;
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
}

/* Exchanges Page Styles */
.exchanges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.exchange-card {
    background-color: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.exchange-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.exchange-status {
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 16px;
}

.exchange-info {
    color: #64748b;
    margin-bottom: 10px;
    font-size: 14px;
}

.exchange-time {
    color: #64748b;
    font-size: 14px;
}

/* Community Page Styles */
.empty-feature-message {
    text-align: center;
    padding: 60px 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.feature-icon {
    font-size: 48px;
    color: #6366f1;
    margin-bottom: 20px;
    opacity: 0.8;
}

.empty-feature-message h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #1e293b;
}

.empty-feature-message p {
    color: #64748b;
    max-width: 500px;
    margin: 0 auto 10px;
}

/* Mock Data Indicator Styles */
.data-source-indicator, .live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 15px;
}

.data-source-indicator.real {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.data-source-indicator.mock {
    background-color: rgba(234, 179, 8, 0.1);
    color: #eab308;
}

.data-source-indicator i, .live-indicator i {
    font-size: 10px;
}

/* Live Indicator Styles */
.live-indicator {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Pulsing Animation for Live Indicator */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.pulse {
    animation: pulse 1.5s infinite ease-in-out;
}

/* Live Update Toggle Button */
.live-toggle {
    padding: 6px 12px;
    background-color: #f3f4f6;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.live-toggle:hover {
    background-color: #e2e8f0;
}

.live-toggle.active {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.chart-controls {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

/* API Key Missing Notification */
.api-key-missing {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-in-out;
}

.api-key-content {
    background-color: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.api-key-content i {
    font-size: 48px;
    color: #f59e0b;
    margin-bottom: 20px;
}

.api-key-content h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #1e293b;
}

.api-key-content p {
    color: #64748b;
    margin-bottom: 15px;
    line-height: 1.5;
}

.api-key-content .code-snippet {
    background-color: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    font-family: monospace;
    text-align: left;
    margin: 20px 0;
    border-left: 4px solid #6366f1;
}

.api-key-content .highlight {
    color: #ef4444;
    font-weight: bold;
}

.api-key-content .note {
    font-style: italic;
    font-size: 14px;
    margin-top: 20px;
}

.api-key-content a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

.api-key-content a:hover {
    text-decoration: underline;
}

.api-key-content button {
    background-color: #6366f1;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.2s ease;
}

.api-key-content button:hover {
    background-color: #4f46e5;
}

/* Additional Responsive Styles */
@media (max-width: 576px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .time-filters {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .time-filter {
        flex: 1;
        text-align: center;
        font-size: 12px;
        padding: 6px 8px;
    }
    
    .chart-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .action-btn {
        flex: 1;
        padding: 8px;
        font-size: 13px;
    }
    
    .converter-inputs {
        flex-direction: column;
    }
    
    .converter-inputs i {
        transform: rotate(90deg);
        margin: 5px 0;
    }
}
