/* =========================================================
   CRYPTO EXCHANGE — Front-End Styles v1.0.3
   ========================================================= */

:root {
    --ce-primary: #6c5ce7;
    --ce-primary-hover: #5a4bd1;
    --ce-green: #00b894;
    --ce-red: #e74c3c;
    --ce-dark: #1e1e2f;
    --ce-dark2: #2d2d44;
    --ce-card-bg: #ffffff;
    --ce-border: #e2e8f0;
    --ce-text: #2d3748;
    --ce-muted: #a0aec0;
    --ce-radius: 10px;
    --ce-filter-bg: #f4f4f8;
}

/* ---- Widget ---- */
.ce-widget {
    background: var(--ce-card-bg);
    border: 1px solid var(--ce-border);
    border-radius: var(--ce-radius);
    margin: 20px 0;
    overflow: visible;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Filters Bar ---- */
.ce-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: var(--ce-filter-bg);
    border-bottom: 1px solid var(--ce-border);
    border-radius: var(--ce-radius) var(--ce-radius) 0 0;
}

.ce-filter-group { display: flex; flex-direction: column; gap: 4px; position: relative; }
.ce-filter-group label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ce-muted); }

/* ---- Single Select ---- */
.ce-select {
    appearance: none; -webkit-appearance: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a0aec0'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid var(--ce-border); border-radius: 6px;
    padding: 8px 32px 8px 12px; font-size: 13px; color: var(--ce-text);
    cursor: pointer; min-width: 140px; transition: border-color 0.2s, box-shadow 0.2s;
}
.ce-select:hover { border-color: var(--ce-primary); }
.ce-select:focus { outline: none; border-color: var(--ce-primary); box-shadow: 0 0 0 3px rgba(108,92,231,.15); }

/* ---- Multi Select ---- */
.ce-multiselect { position: relative; min-width: 160px; }

.ce-multiselect-toggle {
    display: flex; align-items: center; justify-content: space-between;
    background: #fff; border: 1px solid var(--ce-border); border-radius: 6px;
    padding: 8px 12px; font-size: 13px; color: var(--ce-text);
    cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; user-select: none;
}
.ce-multiselect-toggle:hover { border-color: var(--ce-primary); }
.ce-multiselect-toggle:focus { outline: none; border-color: var(--ce-primary); box-shadow: 0 0 0 3px rgba(108,92,231,.15); }

.ce-multiselect-arrow { font-size: 10px; color: var(--ce-muted); margin-left: 8px; transition: transform 0.2s; }
.ce-multiselect.open .ce-multiselect-arrow { transform: rotate(180deg); }

.ce-multiselect-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    min-width: 220px; max-height: 300px; overflow-y: auto;
    background: #fff; border: 1px solid var(--ce-border); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 1000; padding: 6px 0;
}
.ce-multiselect.open .ce-multiselect-dropdown { display: block; }

.ce-multiselect-option {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; font-size: 13px; color: var(--ce-text);
    cursor: pointer; transition: background 0.15s;
}
.ce-multiselect-option:hover { background: var(--ce-filter-bg); }
.ce-multiselect-option input[type="checkbox"] { accent-color: var(--ce-primary); width: 15px; height: 15px; cursor: pointer; }

/* Select All row */
.ce-multiselect-all { background: #f0f0ff; }
.ce-multiselect-all:hover { background: #e4e4ff; }

.ce-multiselect-divider { height: 1px; background: var(--ce-border); margin: 4px 0; }

/* ---- Button ---- */
.ce-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 8px 18px; border: none; border-radius: 6px;
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.ce-btn-apply { background: var(--ce-primary); color: #fff; }
.ce-btn-apply:hover { background: var(--ce-primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,92,231,.3); }
.ce-btn-apply:active { transform: translateY(0); }
.ce-btn-apply.ce-loading { opacity: 0.7; pointer-events: none; }

/* ---- Content & Loading ---- */
.ce-content { position: relative; min-height: 60px; }
.ce-content.ce-loading-content::after {
    content: ''; position: absolute; inset: 0;
    background: rgba(255,255,255,0.7); border-radius: 0 0 var(--ce-radius) var(--ce-radius); z-index: 10;
}
.ce-content.ce-loading-content::before {
    content: '⏳ Chargement...'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); z-index: 11;
    font-size: 14px; color: var(--ce-primary); font-weight: 600;
}

/* ---- TradingView Links ---- */
.ce-tv-link, .ce-tv-link-header { color: inherit; text-decoration: none; transition: color 0.2s; }
.ce-tv-link:hover { color: var(--ce-primary); text-decoration: underline; }
.ce-tv-link-header { color: #fff; }
.ce-tv-link-header:hover { color: #ffd93d; text-decoration: underline; }
a.ce-ticker-item { text-decoration: none; color: #fff; transition: opacity 0.2s; }
a.ce-ticker-item:hover { opacity: 0.8; }

/* ---- Price Card ---- */
.ce-price-card { text-align: center; padding: 30px 20px; }
.ce-price-label { font-size: 14px; color: var(--ce-muted); margin-bottom: 6px; }
.ce-price-value { font-size: 36px; font-weight: 800; color: var(--ce-green); letter-spacing: -1px; }
.ce-price-exchange { font-size: 14px; color: var(--ce-text); margin-top: 4px; }
.ce-price-time { font-size: 12px; color: var(--ce-muted); margin-top: 8px; }

/* ---- Section Headers ---- */
.ce-section-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; background: linear-gradient(135deg, var(--ce-dark), var(--ce-dark2)); color: #fff;
}
.ce-section-header h3 { margin: 0; font-size: 17px; color: #fff; }
.ce-section-header h3 small { font-weight: 400; color: var(--ce-muted); }
.ce-spread { background: rgba(255,255,255,0.15); padding: 4px 14px; border-radius: 50px; font-size: 14px; color: #fff; }
.ce-spread strong { color: #ffd93d; }

/* ---- Tables ---- */
.ce-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ce-table thead th {
    background: var(--ce-dark); color: #fff; padding: 12px 14px; text-align: left;
    font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
.ce-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--ce-border); color: var(--ce-text); }
.ce-table tbody tr:hover { background: #f7fafc; }
.ce-coin-icon { width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; border-radius: 50%; }

.ce-buy td:nth-child(4), td.ce-buy { color: var(--ce-green); font-weight: 700; }
.ce-sell td:nth-child(4), td.ce-sell { color: var(--ce-red); font-weight: 700; }
.ce-profit { color: var(--ce-green); font-weight: 700; }
.ce-up { color: var(--ce-green); font-weight: 600; }
.ce-down { color: var(--ce-red); font-weight: 600; }
.ce-no-opportunity { padding: 30px 20px; text-align: center; color: var(--ce-muted); font-size: 15px; }

/* ---- Fee columns ---- */
.ce-fee { color: #e67e22; font-size: 13px; }
.ce-fee small { color: var(--ce-muted); font-size: 11px; }
.ce-loss { color: var(--ce-red); font-weight: 700; }

.ce-fee-legend {
    padding: 10px 20px;
    font-size: 11px;
    color: var(--ce-muted);
    background: #fefce8;
    border-top: 1px solid #fde68a;
}

/* Arbitrage table scroll on small screens */
.ce-arb-table { min-width: 900px; }
.ce-widget { overflow-x: auto; }

/* ---- Footer & Error ---- */
.ce-footer {
    padding: 10px 20px; font-size: 12px; color: var(--ce-muted);
    border-top: 1px solid var(--ce-border); background: #f9fafb;
    border-radius: 0 0 var(--ce-radius) var(--ce-radius);
}
.ce-error {
    background: #fff5f5; color: var(--ce-red); padding: 12px 18px;
    border-radius: var(--ce-radius); border-left: 4px solid var(--ce-red);
    font-size: 14px; margin: 16px 20px;
}

/* ---- Ticker ---- */
.ce-ticker-wrap { background: var(--ce-dark); overflow: hidden; white-space: nowrap; padding: 10px 0; }
.ce-ticker-track { display: inline-flex; animation: ce-scroll 30s linear infinite; }
.ce-ticker-item { display: inline-flex; align-items: center; gap: 6px; padding: 0 28px; color: #fff; font-size: 14px; }
.ce-ticker-icon { width: 20px; height: 20px; border-radius: 50%; }

@keyframes ce-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .ce-filters { gap: 8px; }
    .ce-filter-group { flex: 1 1 calc(50% - 8px); min-width: 0; }
    .ce-select, .ce-multiselect-toggle { width: 100%; min-width: 0; }
    .ce-table { font-size: 12px; }
    .ce-table thead th, .ce-table tbody td { padding: 8px 10px; }
    .ce-section-header { flex-direction: column; gap: 8px; }
    .ce-price-value { font-size: 28px; }
}
@media (max-width: 480px) {
    .ce-filter-group { flex: 1 1 100%; }
}
