/* Toker Statistik Dashboard Frontend Styles */

.toker-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dashboard-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 28px;
    font-weight: 700;
}

.dashboard-filters {
    display: flex;
    gap: 20px;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#refresh-dashboard {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

#refresh-dashboard:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Widget Sizes */
.widget-small { 
    grid-column: span 1; 
}

.widget-medium { 
    grid-column: span 2; 
}

.widget-large { 
    grid-column: span 3; 
}

.widget-full { 
    grid-column: span 4; 
}

/* Widget Base Styles */
.dashboard-widget {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dashboard-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f8f9fa;
}

.widget-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.widget-refresh {
    background: none;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    font-size: 16px;
    transition: color 0.3s ease;
    padding: 5px;
    border-radius: 4px;
}

.widget-refresh:hover {
    color: #3498db;
    background: #f8f9fa;
}

.widget-content {
    min-height: 100px;
}

/* Counter Widget */
.widget-counter .counter-value {
    font-size: 48px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 8px;
    display: block;
}

.widget-counter .counter-label {
    font-size: 14px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-counter .counter-trend {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 500;
}

.counter-trend.positive {
    color: #27ae60;
}

.counter-trend.positive:before {
    content: "↗ ";
}

.counter-trend.negative {
    color: #e74c3c;
}

.counter-trend.negative:before {
    content: "↘ ";
}

.counter-trend.neutral {
    color: #7f8c8d;
}

.counter-trend.neutral:before {
    content: "→ ";
}

/* Chart Widget */
.widget-chart {
    position: relative;
}

.widget-chart canvas {
    max-height: 300px;
    width: 100% !important;
    height: auto !important;
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #7f8c8d;
}

/* Table Widget */
.widget-table {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.widget-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.widget-table th,
.widget-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.widget-table th {
    font-weight: 600;
    color: #2c3e50;
    background: #f8f9fa;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.widget-table tr:hover {
    background: #f8f9fa;
}

.widget-table .number-cell {
    text-align: right;
    font-weight: 500;
}

.widget-table .currency-cell {
    color: #27ae60;
    font-weight: 600;
}

/* Widget Status Indicators */
.widget-status {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.widget-status.loading {
    background: #f39c12;
    animation: pulse 2s infinite;
}

.widget-status.loaded {
    background: #27ae60;
}

.widget-status.error {
    background: #e74c3c;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Loading States */
.dashboard-loading {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.dashboard-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: #7f8c8d;
    flex-direction: column;
    gap: 10px;
}

.widget-loading .mini-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error States */
.widget-error {
    background: #fff5f5;
    border: 2px solid #fed7d7;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #e53e3e;
    margin: 10px 0;
}

.widget-error h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.widget-error p {
    margin: 0;
    font-size: 14px;
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.no-data h3 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 18px;
}

.no-data p {
    margin: 0;
    font-size: 14px;
}

/* Widget Color Schemes */
.widget-scheme-blue {
    border-left: 4px solid #3498db;
}

.widget-scheme-blue .counter-value {
    color: #3498db;
}

.widget-scheme-green {
    border-left: 4px solid #27ae60;
}

.widget-scheme-green .counter-value {
    color: #27ae60;
}

.widget-scheme-orange {
    border-left: 4px solid #f39c12;
}

.widget-scheme-orange .counter-value {
    color: #f39c12;
}

.widget-scheme-red {
    border-left: 4px solid #e74c3c;
}

.widget-scheme-red .counter-value {
    color: #e74c3c;
}

.widget-scheme-purple {
    border-left: 4px solid #9b59b6;
}

.widget-scheme-purple .counter-value {
    color: #9b59b6;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .widget-large,
    .widget-full {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .toker-dashboard {
        padding: 15px;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .dashboard-filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .widget-small,
    .widget-medium,
    .widget-large,
    .widget-full {
        grid-column: span 1;
    }
    
    .dashboard-widget {
        padding: 20px;
    }
    
    .widget-counter .counter-value {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .dashboard-widget {
        padding: 16px;
    }
    
    .widget-header {
        margin-bottom: 15px;
    }
    
    .widget-title {
        font-size: 14px;
    }
    
    .widget-counter .counter-value {
        font-size: 28px;
    }
    
    .filter-group input,
    .filter-group select {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { 
        transform: translateX(-20px); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

/* Print Styles */
@media print {
    .dashboard-header .dashboard-filters,
    .widget-refresh {
        display: none !important;
    }
    
    .dashboard-widget {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .dashboard-grid {
        display: block;
    }
    
    .widget-chart canvas {
        max-height: 200px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .toker-dashboard {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .dashboard-widget {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .dashboard-header {
        background: #2d2d2d;
    }
    
    .dashboard-header h2,
    .widget-title {
        color: #e0e0e0;
    }
    
    .filter-group input,
    .filter-group select {
        background: #3d3d3d;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .widget-table th {
        background: #3d3d3d;
        color: #e0e0e0;
    }
    
    .widget-table tr:hover {
        background: #3d3d3d;
    }
}