/* ============================================
   CRYPTO MINI WIDGET STYLES
   ============================================ */

/* Base Widget Container - Links ausgerichtet */
.crypto-mini-widget-container {
    position: relative;
    min-height: 280px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    margin: 8px 0;
}

/* Main Widget */
.crypto-mini-widget {
    width: 780px;
    height: 400px;
    max-width: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid #2d2d44;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 360px) {
    .crypto-mini-widget {
        width: 320px;
        height: 320px;
    }
}

.crypto-mini-widget:hover {
    border-color: #3d3d5c;
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

/* Widget Header */
.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.widget-coin-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.widget-coin-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.widget-coin-name {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
    letter-spacing: 0.5px;
}

.widget-price-compact {
    font-size: 13px;
    font-weight: 600;
    color: #a78bfa;
    margin-left: 4px;
}

/* Widget Actions */
.widget-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.widget-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #a0a0b8;
}

.widget-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    transform: scale(1.05);
}

.widget-btn:active {
    transform: scale(0.95);
}

.widget-btn svg {
    width: 16px;
    height: 16px;
}

/* Price Section */
.widget-price-section {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
}

.widget-price {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.widget-change {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.widget-change.positive {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.widget-change.negative {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.change-icon {
    font-size: 10px;
}

/* Market Info Section */
.widget-market-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 11px;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.market-info-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.market-info-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.market-info-item svg {
    opacity: 0.6;
}

.market-info-separator {
    opacity: 0.4;
}

.widget-change-compact {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.widget-change-compact.positive {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.widget-change-compact.negative {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.widget-change-compact .change-icon {
    font-size: 9px;
}

/* Widget Controls - Timeframe & Chart Mode */
.widget-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.widget-timeframe-selector {
    display: flex;
    gap: 4px;
}

.timeframe-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #a0a0b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeframe-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(147, 51, 234, 0.4);
    color: #c0c0d8;
}

.timeframe-btn.active {
    background: rgba(147, 51, 234, 0.2);
    border-color: rgba(147, 51, 234, 0.5);
    color: #a78bfa;
}

.widget-chart-mode-toggle {
    display: flex;
    gap: 4px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #a0a0b8;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(147, 51, 234, 0.4);
    color: #c0c0d8;
}

.mode-btn.active {
    background: rgba(147, 51, 234, 0.2);
    border-color: rgba(147, 51, 234, 0.5);
    color: #a78bfa;
}

.mode-btn svg {
    width: 14px;
    height: 14px;
}

/* Chart Section */
.widget-chart-section {
    width: 100%;
    height: 200px;
    min-height: 150px;
    position: relative;
    margin: 4px 0;
    flex: 1;
}

.widget-chart-container {
    width: 100%;
    height: 100%;
    min-height: 150px;
    position: relative;
}

.widget-sparkline {
    width: 100%;
    height: 100%;
    display: block;
}

/* Footer */
/* Loading State */
.crypto-mini-widget.loading {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.widget-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.widget-loading-text {
    color: #a0a0b8;
    font-size: 14px;
}

/* Error State */
.crypto-mini-widget.error {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

.widget-error-icon {
    font-size: 32px;
}

.widget-error-text {
    color: #ef4444;
    font-size: 14px;
    text-align: center;
}


/* ============================================
   CRYPTO WIDGETS GRID
   ============================================ */

.crypto-widgets-grid {
    display: grid;
    gap: 16px;
    padding: 16px 0;
    width: 100%;
    margin: 0 auto;
}

/* Mobile: 1 Column */
@media (max-width: 640px) {
    .crypto-widgets-grid {
        grid-template-columns: 1fr;
    }
    
    .crypto-mini-widget {
        max-width: 100%;
    }
}

/* Tablet: 2 Columns */
@media (min-width: 641px) and (max-width: 1024px) {
    .crypto-widgets-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3-4 Columns */
@media (min-width: 1025px) {
    .crypto-widgets-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        max-width: 1200px;
    }
}


/* ============================================
   AIONITY CHART CONTAINER OVERRIDE
   ============================================ */

/* Override old iframe style when using mini widgets */
.aionity-chart-container.use-mini-widget {
    padding: 0;
    background: transparent;
    border: none;
}

.aionity-chart-container.use-mini-widget .aionity-chart-header {
    display: none;
}

.aionity-chart-container.use-mini-widget .aionity-chart-iframe {
    display: none;
}


/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.crypto-mini-widget {
    animation: fadeIn 0.3s ease-out;
}

/* Price update pulse animation */
@keyframes pricePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.widget-price.updated {
    animation: pricePulse 0.4s ease-out;
}


/* ============================================
   DARK/LIGHT THEME SUPPORT
   ============================================ */

/* Light theme overrides (if needed) */
@media (prefers-color-scheme: light) {
    .crypto-mini-widget {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-color: #dee2e6;
    }
    
    .widget-coin-name,
    .widget-price {
        color: #212529;
    }
    
    .widget-btn {
        background: rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.1);
        color: #495057;
    }
    
    .widget-btn:hover {
        background: rgba(0, 0, 0, 0.1);
        border-color: rgba(0, 0, 0, 0.2);
        color: #212529;
    }
}


/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Extra small screens */
@media (max-width: 480px) {
    .widget-price {
        font-size: 20px;
    }
    
    .widget-change {
        font-size: 12px;
        padding: 3px 8px;
    }
    
    .widget-coin-name {
        font-size: 14px;
    }
    
    .crypto-mini-widget {
        padding: 12px;
    }
}

/* Print styles */
@media print {
    .crypto-widgets-grid {
        display: block;
    }
    
    .crypto-mini-widget {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .widget-actions {
        display: none;
    }
}


/* ============================================
   ACCESSIBILITY
   ============================================ */

.widget-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .crypto-mini-widget,
    .widget-btn,
    .widget-price.updated {
        animation: none;
        transition: none;
    }
    
    .widget-loading-spinner {
        animation: none;
        border-top-color: transparent;
    }
}


/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
    .crypto-mini-widget {
        border-width: 2px;
    }
    
    .widget-btn {
        border-width: 2px;
    }
    
    .widget-change.positive {
        border: 1px solid #10b981;
    }
    
    .widget-change.negative {
        border: 1px solid #ef4444;
    }
}

/* ==================== FULLSCREEN MODAL ==================== */

.crypto-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.crypto-modal-content {
    background: linear-gradient(145deg, rgba(30, 30, 50, 0.98), rgba(20, 20, 35, 0.98));
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    height: 80vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 100px rgba(147, 51, 234, 0.1);
}

.crypto-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.crypto-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.crypto-modal-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.crypto-modal-price {
    color: #a78bfa;
    margin-left: 8px;
}

.crypto-modal-change {
    margin-left: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.crypto-modal-change.positive {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.crypto-modal-change.negative {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.crypto-modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
}

.crypto-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.crypto-modal-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
}

.crypto-modal-timeframes,
.crypto-modal-modes {
    display: flex;
    gap: 6px;
}

.modal-tf-btn,
.modal-mode-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #a0a0b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-tf-btn:hover,
.modal-mode-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(147, 51, 234, 0.4);
    color: #c0c0d8;
}

.modal-tf-btn.active,
.modal-mode-btn.active {
    background: rgba(147, 51, 234, 0.2);
    border-color: rgba(147, 51, 234, 0.5);
    color: #a78bfa;
}

.crypto-modal-fullcharts {
    margin-left: auto;
    color: #a78bfa;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.crypto-modal-fullcharts:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

.crypto-modal-chart {
    flex: 1;
    padding: 16px;
    min-height: 0;
}

/* Responsive modal */
@media (max-width: 640px) {
    .crypto-modal-content {
        max-width: 100%;
        height: 90vh;
        max-height: none;
        border-radius: 12px;
    }
    
    .crypto-modal-controls {
        gap: 10px;
    }
    
    .crypto-modal-fullcharts {
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }
}
#tv-attr-logo,
a#tv-attr-logo,
.tv-lightweight-charts #tv-attr-logo,
a[href*="tradingview.com"][title*="TradingView"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
