/* Custom CSS for the Freqtrade Dashboard */

/* Navigation Styles */
.nav-link {
    @apply px-3 py-2 rounded-md text-sm font-medium text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors duration-200;
}

.nav-link-active {
    @apply text-primary-600 bg-primary-50;
}

.mobile-nav-link {
    @apply block px-3 py-2 rounded-md text-base font-medium text-gray-500 hover:text-gray-700 hover:bg-gray-100;
}

.mobile-nav-link-active {
    @apply text-primary-600 bg-primary-50;
}

/* Alert Styles */
.alert {
    @apply p-4 rounded-lg border;
}

.alert-success {
    @apply bg-success-50 border-success-200 text-success-700;
}

.alert-error {
    @apply bg-danger-50 border-danger-200 text-danger-700;
}

.alert-warning {
    @apply bg-warning-50 border-warning-200 text-warning-700;
}

.alert-info {
    @apply bg-blue-50 border-blue-200 text-blue-700;
}

/* Card Styles */
.card {
    @apply bg-white rounded-xl shadow-lg border border-gray-200 overflow-hidden mb-6;
}

.card-header {
    @apply px-6 py-4 border-b border-gray-200 bg-gradient-to-r from-gray-50 to-white;
}

.card-body {
    @apply p-6;
}

.card-footer {
    @apply px-6 py-4 border-t border-gray-200 bg-gray-50;
}

/* Enhanced Card Variants */
.card-compact {
    @apply bg-white rounded-lg shadow-md border border-gray-200 overflow-hidden mb-4;
}

.card-elevated {
    @apply bg-white rounded-xl shadow-xl border border-gray-200 overflow-hidden mb-8;
}

.stat-card {
    @apply bg-gradient-to-br from-white to-gray-50 rounded-xl shadow-lg border border-gray-200 p-6 hover:shadow-xl transition-shadow duration-300;
}

/* Status Badge Styles */
.status-badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}

.status-completed {
    @apply bg-success-100 text-success-800;
}

.status-running {
    @apply bg-blue-100 text-blue-800;
}

.status-failed {
    @apply bg-danger-100 text-danger-800;
}

.status-pending {
    @apply bg-warning-100 text-warning-800;
}

/* Failed status text color override */
.status-failed-text {
    color: #dc2626 !important;
    font-weight: 600 !important;
}

/* Completed status text color override */
.status-completed-text {
    color: #059669 !important;
    font-weight: 600 !important;
}

/* Status icon colors */
.status-failed .fas {
    color: #dc2626 !important;
}

.status-completed .fas {
    color: #059669 !important;
}

/* Metric Cards */
.metric-card {
    @apply bg-white rounded-lg shadow-sm border border-gray-200 p-6;
}

.metric-value {
    @apply text-2xl font-bold;
}

.metric-label {
    @apply text-sm text-gray-500 mt-1;
}

.metric-change {
    @apply text-sm font-medium;
}

.metric-positive {
    @apply text-success-600;
}

.metric-negative {
    @apply text-danger-600;
}

/* Table Styles */
.table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.table thead {
    background: linear-gradient(to right, #f9fafb, #f3f4f6);
}

.table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
}

.table td {
    padding: 1rem 1.5rem;
    white-space: nowrap;
    font-size: 0.875rem;
    color: #111827;
    border-bottom: 1px solid #f3f4f6;
}

.table tbody tr:hover {
    background-color: #f8fafc;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

/* Enhanced Table Container */
.table-container {
    width: 100%;
    overflow-x: auto;
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.table-compact {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

/* Collapsible Sections */
.collapsible {
    @apply bg-white rounded-lg shadow-md border border-gray-200 overflow-hidden mb-4;
}

.collapsible-header {
    @apply px-6 py-4 bg-gradient-to-r from-gray-50 to-white border-b border-gray-200 cursor-pointer hover:bg-gray-100 transition-colors duration-200;
}

.collapsible-content {
    @apply px-6 py-4 max-h-0 overflow-hidden transition-all duration-300 ease-in-out;
}

.collapsible-content.expanded {
    @apply max-h-screen py-4;
}

.collapsible-icon {
    @apply transition-transform duration-300 transform;
}

.collapsible-icon.rotated {
    @apply rotate-180;
}

/* Page Headers */
.page-header {
    @apply mb-8;
}

.page-title {
    @apply text-3xl font-bold text-gray-900 mb-2;
}

.page-subtitle {
    @apply text-lg text-gray-600;
}

/* Content Sections */
.content-section {
    @apply mb-8;
}

.section-title {
    @apply text-xl font-semibold text-gray-900 mb-4;
}

/* Stats Grid */
.stats-grid {
    @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8;
}

.stats-grid-3 {
    @apply grid grid-cols-1 md:grid-cols-3 gap-6 mb-8;
}

/* Enhanced Filter Panel */
.filter-panel {
    @apply bg-white border border-gray-200 rounded-xl shadow-lg p-6 mb-8;
}

.filter-header {
    @apply flex justify-between items-center mb-4;
}

.filter-title {
    @apply text-lg font-semibold text-gray-900;
}

.filter-toggle {
    @apply text-primary-600 hover:text-primary-800 cursor-pointer transition-colors duration-200;
}

/* Responsive table improvements */
@media (max-width: 768px) {
    .table th, .table td {
        @apply px-2 py-2;
    }
    
    .table th {
        @apply text-xs;
    }
    
    .table td {
        @apply text-xs;
    }
}

/* Better handling of long text in tables */
.table .break-words {
    word-break: break-word;
    max-width: 200px;
}

.table .truncate-text {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Form Styles */
.form-input {
    @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500;
}

.form-select {
    @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500;
}

.form-label {
    @apply block text-sm font-medium text-gray-700 mb-1;
}

/* Button Styles */
.btn {
    @apply inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors duration-200;
}

.btn-primary {
    @apply text-white bg-primary-600 hover:bg-primary-700 focus:ring-primary-500;
}

.btn-secondary {
    @apply text-gray-700 bg-white border-gray-300 hover:bg-gray-50 focus:ring-primary-500;
}

.btn-success {
    @apply text-white bg-success-600 hover:bg-success-700 focus:ring-success-500;
}

.btn-danger {
    @apply text-white bg-danger-600 hover:bg-danger-700 focus:ring-danger-500;
}

.btn-sm {
    @apply px-3 py-1.5 text-xs;
}

.btn-lg {
    @apply px-6 py-3 text-base;
}

/* Chart Containers */
.chart-container {
    @apply relative h-64 w-full;
}

.chart-large {
    @apply h-96;
}

.chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.chart-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(248, 250, 252, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Chart responsive behavior */
@media (max-width: 768px) {
    .chart-container {
        height: 300px;
    }
}

/* Progress Bar */
.progress-bar {
    @apply w-full bg-gray-200 rounded-full h-2;
}

.progress-fill {
    @apply h-2 rounded-full transition-all duration-300;
}

.progress-success {
    @apply bg-success-500;
}

.progress-warning {
    @apply bg-warning-500;
}

.progress-danger {
    @apply bg-danger-500;
}

/* Pagination */
.pagination {
    @apply flex items-center justify-between border-t border-gray-200 bg-white px-4 py-3 sm:px-6;
}

.pagination-info {
    @apply flex flex-1 justify-between sm:hidden;
}

.pagination-nav {
    @apply hidden sm:flex sm:flex-1 sm:items-center sm:justify-between;
}

.pagination-links {
    @apply isolate inline-flex -space-x-px rounded-md shadow-sm;
}

.pagination-link {
    @apply relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-500 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0;
}

.pagination-link-active {
    @apply relative z-10 inline-flex items-center bg-primary-600 px-4 py-2 text-sm font-semibold text-white focus:z-20 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600;
}

/* Loading States */
.skeleton {
    @apply animate-pulse bg-gray-200 rounded;
}

.skeleton-text {
    @apply h-4 bg-gray-200 rounded w-3/4;
}

.skeleton-circle {
    @apply rounded-full bg-gray-200;
}

/* Responsive Utilities */
@screen sm {
    .metric-card {
        @apply p-8;
    }
    
    .metric-value {
        @apply text-3xl;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if required */
}

/* Custom animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Filter panel */
.filter-panel {
    @apply bg-white border border-gray-200 rounded-lg shadow-sm p-4 mb-6;
}

.filter-group {
    @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4;
}

/* Responsive filter panel improvements */
@media (max-width: 768px) {
    .filter-panel {
        @apply p-3;
    }
    
    .filter-group {
        @apply grid-cols-1 gap-3;
    }
    
    .filter-input {
        @apply text-sm;
    }
}

/* Search box improvements */
.search-box {
    @apply relative;
}

.search-input {
    @apply block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-primary-500 focus:border-primary-500;
}

.search-icon {
    @apply absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none;
}

/* Mobile search improvements */
@media (max-width: 768px) {
    .search-input {
        @apply pl-8 text-sm;
    }
    
    .search-icon {
        @apply pl-2;
    }
}

/* Tooltip */
.tooltip {
    @apply invisible absolute z-10 px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 transition-opacity duration-300;
}

.tooltip-trigger:hover .tooltip {
    @apply visible opacity-100;
}

/* Tab Styles */
.tab-container {
    margin-bottom: 1.5rem;
}

.tab-navigation {
    display: flex;
    gap: 0.25rem;
    background-color: #f3f4f6;
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.tab-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
    background: transparent;
    border: none;
    cursor: pointer;
}

.tab-button:hover:not(.active) {
    color: #374151;
    background-color: rgba(255, 255, 255, 0.7);
}

.tab-button.active {
    background-color: white;
    color: #2563eb;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    font-weight: 600;
}

.tab-button:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.tab-badge {
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #dbeafe;
    color: #1e40af;
}

.tab-button.active .tab-badge {
    background-color: #2563eb;
    color: white;
}

.tab-content {
    position: relative;
    width: 100%;
}

.tab-panel {
    display: none;
    opacity: 0;
    transform: translateY(0.5rem);
    transition: all 0.3s ease-in-out;
    width: 100%;
}

.tab-panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    width: 100%;
}

/* Ensure cards within tab panels take full width */
.tab-panel .card {
    width: 100%;
    margin-bottom: 0;
}

/* Responsive tab navigation */
@media (max-width: 640px) {
    .tab-navigation {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .tab-button {
        flex: none;
        justify-content: flex-start;
        padding: 0.5rem 0.75rem;
    }
    
    .tab-badge {
        margin-left: auto;
    }
}

/* Chart placeholder styling */
.chart-placeholder {
    min-height: 12rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    border: 2px dashed #e5e7eb;
}

/* Data visualization helpers */
.profit-positive {
    @apply text-success-600 font-semibold;
}

.profit-negative {
    color: #dc2626;
    font-weight: 600;
}

.profit-neutral {
    color: #6b7280;
}

/* Additional table width fixes */
.table-container {
    width: 100% !important;
    max-width: 100% !important;
}

.table {
    width: 100% !important;
    table-layout: auto;
}

.tab-panel .card {
    width: 100% !important;
}

/* Force full width for trades table */
#trades-tab .table-container,
#trades-tab .table {
    width: 100% !important;
    min-width: 100% !important;
}

/* Strategy Page Specific Styles */
.strategy-color-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.strategy-success-rate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.strategy-timeframe-badge {
    display: inline-block;
    padding: 2px 6px;
    background-color: #dbeafe;
    color: #1e40af;
    border-radius: 4px;
    font-size: 0.75rem;
    margin: 2px;
}

.form-select {
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #374151;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    appearance: none;
}

.form-select:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Enhanced profit styling for strategies */
.profit-positive {
    color: #059669 !important;
    font-weight: 600;
}

.profit-negative {
    color: #dc2626 !important;
    font-weight: 600;
}

.profit-neutral {
    color: #6b7280 !important;
    font-weight: 500;
}

/* Quick Selection Button Styles for Benchmark Page */
.quick-time-btn, .quick-pair-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
    min-height: 2.75rem;
}

.quick-time-btn:hover, .quick-pair-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.quick-time-btn.bg-primary-600, .quick-pair-btn.bg-primary-600 {
    background-color: #2563eb !important;
    color: white !important;
    border-color: #2563eb !important;
}

.quick-time-btn.bg-primary-600:hover, .quick-pair-btn.bg-primary-600:hover {
    background-color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
}

/* Form help text */
.form-help {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Required field indicator */
.form-label.required::after {
    content: " *";
    color: #dc2626;
}

/* Final Balance Column Styling */
.final-balance-cell {
    /* Removed green background and border for normal appearance */
}

.final-balance-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #374151; /* Default gray color */
    display: flex;
    align-items: center;
}

.final-balance-value.profit {
    color: #059669; /* Green for values above $1000 */
}

.final-balance-value.loss {
    color: #dc2626; /* Red for values below $1000 */
}

.final-balance-icon {
    display: none; /* Hide the wallet icon */
}

.final-balance-starting {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 400;
    margin-top: 0.25rem;
}

/* Rankings specific styling */
.ranking-row-1 {
    background: linear-gradient(135deg, #fef3c7 0%, #fcd34d 100%);
    border-left: 4px solid #f59e0b;
}

.ranking-row-2 {
    background: linear-gradient(135deg, #f3f4f6 0%, #d1d5db 100%);
    border-left: 4px solid #9ca3af;
}

.ranking-row-3 {
    background: linear-gradient(135deg, #fef7ff 0%, #f3e8ff 100%);
    border-left: 4px solid #a855f7;
}

.ranking-trophy {
    font-size: 1.25rem;
}

/* Enhanced stat cards for rankings */
.ranking-stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.ranking-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}