/* ===== HEADER STATUS WIDGET ===== */
/* Widget compacto: Diário, Tokens, Plano, Conteúdos */

/* =============================================================================
   DESKTOP - Widget inline no header
   ============================================================================= */

@media (min-width: 769px) {
    .header-status-widget {
        display: flex;
        align-items: center;
        gap: 2px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        padding: 4px 6px;
        margin-left: 4px;
        flex-shrink: 0;
        height: 2.2rem;
        box-sizing: border-box;
    }

    .hsw-item {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 3px 8px;
        border-radius: 5px;
        color: #ffffff;
        text-decoration: none;
        font-size: 0.8rem;
        font-weight: 500;
        white-space: nowrap;
        transition: background 0.2s ease;
        line-height: 1;
        cursor: pointer;
    }

    .hsw-item:hover {
        background: rgba(255, 255, 255, 0.2);
        color: #ffffff;
        text-decoration: none;
    }

    /* Token button - reset button styles */
    button.hsw-item {
        background: transparent;
        border: none;
        font-family: inherit;
        outline: none;
    }

    .hsw-icon {
        font-size: 0.9rem;
        line-height: 1;
    }

    .hsw-label {
        font-size: 0.75rem;
    }

    .hsw-sep {
        width: 1px;
        height: 14px;
        background: rgba(255, 255, 255, 0.25);
        flex-shrink: 0;
    }

    /* Tooltip for tokens */
    .hsw-item[title] {
        position: relative;
    }

    /* ---- Conteúdos Dropdown ---- */
    .hsw-dropdown {
        position: relative;
    }

    .hsw-dropdown-toggle {
        background: transparent;
        border: none;
        font-family: inherit;
        outline: none;
    }

    .hsw-caret {
        font-size: 0.55rem;
        opacity: 0.7;
        margin-left: 1px;
    }

    .hsw-dropdown-menu {
        display: none;
        position: absolute;
        top: calc(100% + 6px);
        right: 0;
        background: #ffffff;
        border-radius: 10px;
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
        min-width: 180px;
        padding: 6px 0;
        z-index: 10001;
        opacity: 0;
        transform: translateY(-4px);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .hsw-dropdown-menu.open {
        display: block;
        opacity: 1;
        transform: translateY(0);
    }

    .hsw-dropdown-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        color: #333 !important;
        text-decoration: none !important;
        font-size: 0.88rem;
        font-weight: 500;
        transition: background 0.15s ease;
        white-space: nowrap;
    }

    .hsw-dropdown-item:hover {
        background: #f0f4ff;
        color: #007cba !important;
    }

    /* Compact mode adjustments */
    .header-content.compact-mode .header-status-widget {
        gap: 1px;
        padding: 3px 4px;
    }

    .header-content.compact-mode .hsw-item {
        padding: 2px 5px;
        font-size: 0.75rem;
    }

    .header-content.compact-mode .hsw-label {
        font-size: 0.7rem;
    }

    /* Super compact mode */
    .header-content.super-compact-mode .header-status-widget {
        gap: 0;
        padding: 2px 3px;
    }

    .header-content.super-compact-mode .hsw-item {
        padding: 2px 4px;
        font-size: 0.7rem;
        gap: 2px;
    }

    .header-content.super-compact-mode .hsw-label {
        display: none;
    }

    .header-content.super-compact-mode .hsw-icon {
        font-size: 0.85rem;
    }

    .header-content.super-compact-mode .hsw-sep {
        height: 10px;
    }

    .header-content.super-compact-mode .hsw-caret {
        display: none;
    }
}

/* =============================================================================
   TOKEN MODAL (global)
   ============================================================================= */

.hsw-token-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10002;
    align-items: center;
    justify-content: center;
}

.hsw-token-backdrop.active {
    display: flex;
}

.hsw-token-modal {
    background: #fff;
    border-radius: 16px;
    width: 90vw;
    max-width: 420px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: hswModalIn 0.25s ease;
}

@keyframes hswModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.hsw-token-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.hsw-token-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1e293b;
}

.hsw-token-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.hsw-token-close:hover {
    color: #475569;
}

.hsw-token-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.hsw-tm-total {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    line-height: 1.1;
}

.hsw-tm-total small {
    font-size: 0.9rem;
    font-weight: 400;
    color: #64748b;
}

.hsw-tm-buckets {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.hsw-tm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
}

.hsw-tm-name {
    font-size: 0.85rem;
    color: #475569;
}

.hsw-tm-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
}

.hsw-tm-plan {
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    padding: 10px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border-radius: 8px;
    margin-top: 4px;
}

.hsw-tm-warning {
    margin-top: 12px;
    padding: 10px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 8px;
    font-size: 0.82rem;
    text-align: center;
}

.hsw-token-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid #f1f5f9;
}

.hsw-token-manage {
    color: #007cba;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.hsw-token-manage:hover {
    text-decoration: underline;
}

.hsw-token-close-btn {
    background: #f1f5f9;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.hsw-token-close-btn:hover {
    background: #e2e8f0;
}

/* Drawer widget badges */
.drawer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #007bff;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: auto;
}

.drawer-badge-alert {
    background: #e53935;
}

/* Drawer widget sub-items (aquarios list) */
.drawer-widget-list {
    display: none;
    padding: 4px 0 4px 48px;
}

.drawer-widget-item {
    display: flex;
    flex-direction: column;
    padding: 6px 12px;
    margin: 2px 0;
    border-radius: 8px;
    background: #f5f7fa;
    text-decoration: none;
    color: #333;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.drawer-widget-item:hover {
    background: #e8ecf0;
    text-decoration: none;
    color: #333;
}

.drawer-widget-item-name {
    font-weight: 500;
    color: #1a1a1a;
}

.drawer-widget-item-meta {
    font-size: 0.75rem;
    color: #888;
}

/* Hide desktop widget on mobile */
@media (max-width: 768px) {
    .header-status-widget {
        display: none !important;
    }
}
