/* css/partials/dashboard.css
   Estilos específicos para página dashboard.php
   Movido de CSS inline para centralização
*/

/* ====== HEADER E CONTROLS ====== */
.page-header .actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.admin-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    min-height: 36px;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    min-height: 36px;
}

.selects-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

/* TOGGLE ADMIN/USER VIEW */
.admin-view-toggle {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border-radius: 6px;
    border: 2px solid #d4af37;
    overflow: hidden;
    height: 36px;
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: inset 0 1px 0 rgba(255, 215, 0, 0.2);
}

.admin-view-toggle .toggle-btn {
    padding: 0 10px;
    border: none;
    background: transparent;
    color: #3d2817;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    height: 100%;
    line-height: 1;
}

.admin-view-toggle .toggle-btn:first-child {
    border-right: 2px solid #d4af37;
}

.admin-view-toggle .toggle-btn.active {
    background: linear-gradient(135deg, #8b6914 0%, #a0790e 100%);
    color: #f5f0e8;
    font-weight: 700;
}

.admin-view-toggle .toggle-btn:hover:not(.active) {
    background: rgba(212, 175, 55, 0.1);
    color: #8b6914;
}

.admin-view-toggle .toggle-btn i {
    font-size: 12px;
}

/* SELECTS E DROPDOWNS */
#view-as-select,
#view-as-character-select {
    height: 36px;
    padding: 0 32px 0 12px;
    min-width: 150px;
    max-width: 250px;
    border: 2px solid #d4af37;
    border-radius: 6px;
    font-size: 13px;
    color: #3d2817;
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    outline: none;
    cursor: pointer;
    margin: 0;
    box-sizing: border-box;
    line-height: 34px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b6914' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 1;
    box-shadow: inset 0 1px 0 rgba(255, 215, 0, 0.15);
}

#view-as-select:hover,
#view-as-character-select:hover {
    border-color: #8b6914;
    box-shadow: inset 0 0 8px rgba(212, 175, 55, 0.1);
}

#view-as-select:focus,
#view-as-character-select:focus {
    border-color: #8b6914;
    box-shadow: inset 0 1px 0 rgba(255, 215, 0, 0.15), 0 0 8px rgba(212, 175, 55, 0.2);
}

#view-as-select option,
#view-as-character-select option {
    padding: 5px;
    background: #f5f0e8;
    color: #3d2817;
}

/* BOTÃO REFRESH */
#refresh-dashboard-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border: 2px solid #d4af37;
    color: #8b6914;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    line-height: 1;
    font-weight: 600;
}

#refresh-dashboard-btn:hover {
    background: linear-gradient(135deg, #8b6914 0%, #a0790e 100%);
    color: #f5f0e8;
    border-color: #ffd700;
    transform: scale(1.05);
}

#refresh-dashboard-btn:active {
    transform: scale(0.95);
}

.fa-spin {
    animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====== CARD HEADER TABS ====== */
.card-header-tabs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 2px solid #d4af37;
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header-tabs > div:first-child {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ====== FEED CONTROLS ====== */
.feed-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.feed-controls input,
.feed-controls select,
.feed-controls button {
    height: 36px !important;
    margin: 0;
    border: 2px solid #d4af37;
    border-radius: 6px;
    font-size: 13px;
    color: #3d2817;
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    font-weight: 600;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.feed-controls input[type="date"] {
    width: 140px;
    padding: 0 10px;
}

.feed-controls select {
    padding: 0 25px 0 10px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b6914' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
}

.feed-controls select:hover,
.feed-controls input:hover {
    border-color: #8b6914;
    box-shadow: inset 0 0 8px rgba(212, 175, 55, 0.1);
}

#feed-month-select { width: 110px; }
#feed-year-select { width: 75px; }

.feed-controls button {
    width: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: none;
    color: #8b6914;
}

.feed-controls button:hover {
    background-color: rgba(212, 175, 55, 0.15);
    border-color: #8b6914;
    color: #8b6914;
}

/* SOURCE TOGGLE */
.source-toggle-btn {
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    border: 2px solid #d4af37;
    color: #3d2817;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 5px;
    transition: all 0.2s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-toggle-btn.active {
    background: linear-gradient(135deg, #8b6914 0%, #a0790e 100%);
    color: #f5f0e8;
    border-color: #ffd700;
}

.source-toggle-btn:hover:not(.active) {
    background: rgba(212, 175, 55, 0.15);
    border-color: #8b6914;
}

#year-filter-select {
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
    border: 2px solid #d4af37;
    border-radius: 6px;
    color: #3d2817;
    outline: none;
    cursor: pointer;
    margin-left: 10px;
    background: linear-gradient(135deg, #f5f0e8 0%, #ebe4d8 100%);
    font-weight: 600;
    transition: all 0.2s ease;
}

#year-filter-select:hover,
#year-filter-select:focus {
    border-color: #8b6914;
    box-shadow: inset 0 0 8px rgba(212, 175, 55, 0.1);
}

/* ====== HERO CARDS STYLING ====== */
.hero-card.primary .hero-label,
.hero-card.primary .hero-value,
.hero-card.primary .sub-values {
    color: #fff;
}

.hero-card.primary .hero-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.hero-card.tertiary {
    background: linear-gradient(135deg, #3b82f6 0%, #3b82f6 100%);
    border: none;
}

.hero-card.tertiary .hero-label,
.hero-card.tertiary .hero-value,
.hero-card.tertiary .sub-values {
    color: #fff;
}

.hero-card.tertiary .hero-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.hero-card.secondary {
    border-bottom: 3px solid #2ecc71;
    color: #333;
}

.hero-card.secondary .hero-label {
    color: #3d2817;
    font-weight: 600;
}

.hero-card.secondary .hero-icon {
    background: #e8f5e9;
    color: #2ecc71;
}

.hero-card.info {
    border-bottom: 3px solid #95a5a6;
    color: #333;
}

.hero-card.info .hero-label {
    color: #3d2817;
    font-weight: 600;
}

.hero-card.info .hero-icon {
    background: #f2f4f6;
    color: #7f8c8d;
}

/* ====== FEED VALUES ====== */
.feed-value.danger {
    color: #c0392b;
    font-weight: 700;
}

.feed-value.success {
    color: #67c23a;
    font-weight: 700;
}

/* ====== LOADING AND EMPTY STATES ====== */
.feed-list p {
    padding: 20px;
    color: #8b6914;
    text-align: center;
    font-style: italic;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
    .admin-controls,
    .user-controls {
        flex-wrap: wrap;
    }

    #view-as-select,
    #view-as-character-select {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    .page-header .actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .selects-wrapper {
        flex-wrap: wrap;
        gap: 8px;
    }

    .admin-controls,
    .user-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    #view-as-select,
    #view-as-character-select {
        max-width: 100%;
        min-width: auto;
    }

    .card-header-tabs {
        flex-direction: column;
        align-items: flex-start;
    }

    .feed-controls {
        flex-wrap: wrap;
        width: 100%;
    }

    .feed-controls input,
    .feed-controls select,
    .feed-controls button {
        flex: 1;
        min-width: 100px;
    }
}

/* TC Tooltip shared styles (migrated from inline dashboard.php) */
.tc-tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.tc-tooltip-trigger {
    height: 36px;
    min-width: 42px;
    padding: 0 12px;
    border: 1px solid #d9d3c5;
    border-radius: 8px;
    background: linear-gradient(135deg, #fff 0%, #f8f5ef 100%);
    color: #7a5b10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.tc-tooltip-trigger:hover,
.tc-tooltip-wrapper.open .tc-tooltip-trigger {
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
    color: #5c4826;
}

.tc-tooltip-trigger .tc-trigger-text {
    font-size: 12px;
    white-space: nowrap;
}

.tc-conversion-controls {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    display: none;
    align-items: flex-start;
    gap: 10px;
    padding: 18px;
    background: linear-gradient(135deg, #fff 0%, #f8f5ef 100%);
    border: 1px solid rgba(212, 175, 55, 0.55);
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
    flex-wrap: wrap;
    min-height: 36px;
    z-index: 3000; /* aumentar para aparecer acima de modais */
    min-width: 520px;
    width: min(92vw, 540px);
    max-width: 92vw;
}

.tc-tooltip-wrapper.open .tc-conversion-controls {
    display: inline-flex;
}

.tc-controls-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #7a5b10;
    width: 100%;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.22);
    margin-bottom: 8px;
    white-space: nowrap;
}

.tc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
    flex: 1 1 170px;
}

.tc-field label {
    font-size: 11px;
    color: #8b7a5a;
    font-weight: 600;
    line-height: 1;
}

#dashboard-tc-world-select,
#dashboard-tc-average-type,
#dashboard-tc-mode-select,
#dashboard-fiat-currency,
#dashboard-tc-custom-input,
#dashboard-global-real-price {
    height: 36px;
    padding: 0 32px 0 12px;
    border: 1px solid #d9d3c5;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #3d2817;
    background-color: #fff;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#dashboard-tc-world-select:focus,
#dashboard-tc-average-type:focus,
#dashboard-tc-mode-select:focus,
#dashboard-fiat-currency:focus,
#dashboard-tc-custom-input:focus,
#dashboard-global-real-price:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.tc-field--currency {
    flex: 0 1 170px;
    min-width: 150px;
    max-width: 190px;
}

.tc-field--price {
    flex: 1 1 260px;
    min-width: 220px;
}

@media (max-width: 992px) {
    .tc-tooltip-trigger .tc-trigger-text { display: none; }
    .tc-conversion-controls { left: 0; right: auto; min-width: 320px; width: min(92vw, 540px); max-width: 92vw; }
    .tc-field { min-width: 140px; flex: 1 1 45%; }
    .tc-field--currency,
    .tc-field--price {
        flex: 1 1 45%;
        min-width: 140px;
        max-width: none;
    }
    #dashboard-tc-world-select, #dashboard-tc-average-type, #dashboard-tc-mode-select, #dashboard-fiat-currency, #dashboard-tc-custom-input, #dashboard-global-real-price { width: 100%; max-width: 100%; }
    .tc-rate-badge { width: 100%; justify-content: center; text-align: center; }
}

/* Badge / resumo inferior (estilo do Dashboard) */
.tc-rate-badge {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 12px;
    padding: 12px 14px;
    background: #fff7e6;
    border: 1px solid rgba(212, 175, 55, 0.18);
    color: #6b4b17;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

.tc-tooltip-trigger {
    height: 38px;
    min-width: 48px;
    padding: 0 14px;
    border-radius: 10px;
}
